[ros-diffs] [tkreuzer] 49660: [CRT] Implement __alloca_probe_16

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Nov 20 13:03:13 UTC 2010


Author: tkreuzer
Date: Sat Nov 20 13:03:11 2010
New Revision: 49660

URL: http://svn.reactos.org/svn/reactos?rev=49660&view=rev
Log:
[CRT]
Implement __alloca_probe_16

Modified:
    branches/cmake-bringup/lib/sdk/crt/except/i386/chkstk_asm.s

Modified: branches/cmake-bringup/lib/sdk/crt/except/i386/chkstk_asm.s
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/sdk/crt/except/i386/chkstk_asm.s?rev=49660&r1=49659&r2=49660&view=diff
==============================================================================
--- branches/cmake-bringup/lib/sdk/crt/except/i386/chkstk_asm.s [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/sdk/crt/except/i386/chkstk_asm.s [iso-8859-1] Sat Nov 20 13:03:11 2010
@@ -14,7 +14,36 @@
 
 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




More information about the Ros-diffs mailing list