1*3cab2bb3Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 2*3cab2bb3Spatrick// See https://llvm.org/LICENSE.txt for license information. 3*3cab2bb3Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 4*3cab2bb3Spatrick 5*3cab2bb3Spatrick#include "../assembly.h" 6*3cab2bb3Spatrick 7*3cab2bb3Spatrick// _chkstk routine 8*3cab2bb3Spatrick// This routine is windows specific 9*3cab2bb3Spatrick// http://msdn.microsoft.com/en-us/library/ms648426.aspx 10*3cab2bb3Spatrick 11*3cab2bb3Spatrick#ifdef __i386__ 12*3cab2bb3Spatrick 13*3cab2bb3Spatrick.text 14*3cab2bb3Spatrick.balign 4 15*3cab2bb3SpatrickDEFINE_COMPILERRT_FUNCTION(__chkstk_ms) 16*3cab2bb3Spatrick push %ecx 17*3cab2bb3Spatrick push %eax 18*3cab2bb3Spatrick cmp $0x1000,%eax 19*3cab2bb3Spatrick lea 12(%esp),%ecx 20*3cab2bb3Spatrick jb 1f 21*3cab2bb3Spatrick2: 22*3cab2bb3Spatrick sub $0x1000,%ecx 23*3cab2bb3Spatrick test %ecx,(%ecx) 24*3cab2bb3Spatrick sub $0x1000,%eax 25*3cab2bb3Spatrick cmp $0x1000,%eax 26*3cab2bb3Spatrick ja 2b 27*3cab2bb3Spatrick1: 28*3cab2bb3Spatrick sub %eax,%ecx 29*3cab2bb3Spatrick test %ecx,(%ecx) 30*3cab2bb3Spatrick pop %eax 31*3cab2bb3Spatrick pop %ecx 32*3cab2bb3Spatrick ret 33*3cab2bb3SpatrickEND_COMPILERRT_FUNCTION(__chkstk_ms) 34*3cab2bb3Spatrick 35*3cab2bb3Spatrick#endif // __i386__ 36