1 1.1 joerg // This file is dual licensed under the MIT and the University of Illinois Open 2 1.1 joerg // Source Licenses. See LICENSE.TXT for details. 3 1.1 joerg 4 1.1 joerg #include "../assembly.h" 5 1.1 joerg 6 1.1 joerg // _chkstk routine 7 1.1 joerg // This routine is windows specific 8 1.1 joerg // http://msdn.microsoft.com/en-us/library/ms648426.aspx 9 1.1 joerg 10 1.1 joerg #ifdef __i386__ 11 1.1 joerg 12 1.1 joerg .text 13 1.1 joerg .balign 4 14 1.1 joerg DEFINE_COMPILERRT_FUNCTION(__chkstk_ms) 15 1.1 joerg push %ecx 16 1.1 joerg push %eax 17 1.1 joerg cmp $0x1000,%eax 18 1.1 joerg lea 12(%esp),%ecx 19 1.1 joerg jb 1f 20 1.1 joerg 2: 21 1.1 joerg sub $0x1000,%ecx 22 1.1 joerg test %ecx,(%ecx) 23 1.1 joerg sub $0x1000,%eax 24 1.1 joerg cmp $0x1000,%eax 25 1.1 joerg ja 2b 26 1.1 joerg 1: 27 1.1 joerg sub %eax,%ecx 28 1.1 joerg test %ecx,(%ecx) 29 1.1 joerg pop %eax 30 1.1 joerg pop %ecx 31 1.1 joerg ret 32 1.1 joerg END_COMPILERRT_FUNCTION(__chkstk_ms) 33 1.1 joerg 34 1.1 joerg #endif // __i386__ 35