Implement __alloca_probe_16

svn path=/branches/cmake-bringup/; revision=49660
This commit is contained in:
Timo Kreuzer 2010-11-20 13:03:11 +00:00
parent 66a7b7ba1d
commit d65aa994f7

View file

@ -14,8 +14,37 @@
PUBLIC __chkstk
PUBLIC __alloca_probe
PUBLIC __alloca_probe_16
.code
/* 16 byte aligned alloca probe
* EAX = size to be allocated */
__alloca_probe_16:
/* save the ECX register */
push ecx
/* ecx = top of the previous stack frame */
lea ecx, [esp + 8]
/* Calculate end of allocation */
sub ecx, eax
/* Get the misalignment */
and ecx, 15
/* Add the misalignment to the original alloc size */
add eax, ecx
/* Check for overflow */
jnc l1
/* Set maximum value */
mov eax, HEX(0ffffffff)
l1:
/* Restore ecx */
pop ecx
/* Fall through to __chkstk */
/*
_chkstk() is called by all stack allocations of more than 4 KB. It grows the
stack in areas of 4 KB each, trying to access each area. This ensures that the