41 lines · plain
1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.2// See https://llvm.org/LICENSE.txt for license information.3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception4 5#include "../assembly.h"6 7// _chkstk routine8// This routine is windows specific9// http://msdn.microsoft.com/en-us/library/ms648426.aspx10//11// This function does not decrement %esp at the end.12 13// GCC after 4.6 generates calls to "___chkstk_ms". For other variants of14// this function, which do decrement %esp, see chkstk2.S.15 16#ifdef __i386__17 18.text19.balign 420DEFINE_COMPILERRT_FUNCTION(__chkstk_ms)21 push %ecx22 push %eax23 cmp $0x1000,%eax24 lea 12(%esp),%ecx25 jb 1f262:27 sub $0x1000,%ecx28 test %ecx,(%ecx)29 sub $0x1000,%eax30 cmp $0x1000,%eax31 ja 2b321:33 sub %eax,%ecx34 test %ecx,(%ecx)35 pop %eax36 pop %ecx37 ret38END_COMPILERRT_FUNCTION(__chkstk_ms)39 40#endif // __i386__41