[CRT]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 20 Nov 2010 13:03:11 +0000 (13:03 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 20 Nov 2010 13:03:11 +0000 (13:03 +0000)
Implement __alloca_probe_16

svn path=/branches/cmake-bringup/; revision=49660

lib/sdk/crt/except/i386/chkstk_asm.s

index 80c9b73..58879f1 100644 (file)
 
 PUBLIC __chkstk
 PUBLIC __alloca_probe
 
 PUBLIC __chkstk
 PUBLIC __alloca_probe
+PUBLIC __alloca_probe_16
 .code
 
 .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
 /*
  _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