[CRT]
authorJérôme Gardou <jerome.gardou@reactos.org>
Sun, 20 Nov 2011 14:04:40 +0000 (14:04 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Sun, 20 Nov 2011 14:04:40 +0000 (14:04 +0000)
- implement _chkesp

svn path=/trunk/; revision=54455

reactos/lib/sdk/crt/crt.cmake
reactos/lib/sdk/crt/crt.rbuild
reactos/lib/sdk/crt/except/i386/chkesp.s [new file with mode: 0644]
reactos/lib/sdk/crt/except/stack.c

index a6e79cb..96e0541 100644 (file)
@@ -306,6 +306,7 @@ list(APPEND CRT_SOURCE
 
 if(ARCH MATCHES i386)
     list(APPEND CRT_SOURCE
+        except/i386/chkesp.s
         except/i386/prolog.s
         except/i386/seh.s
         except/i386/seh_prolog.s
index e45776e..d8c24fb 100644 (file)
@@ -5,6 +5,7 @@
        <directory name="except">
                <if property="ARCH" value="i386">
                        <directory name="i386">
+                <file>chkesp.s</file>
                                <file>chkstk_asm.s</file>
                                <file>chkstk_ms.s</file>
                        </directory>
diff --git a/reactos/lib/sdk/crt/except/i386/chkesp.s b/reactos/lib/sdk/crt/except/i386/chkesp.s
new file mode 100644 (file)
index 0000000..5a89701
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * COPYRIGHT:         See COPYING in the top level directory
+ * PROJECT:           ReactOS C run time library
+ * PURPOSE:           Stack checker
+ * PROGRAMMERS:       Jérôme Gardou
+ */
+
+#include <asm.inc>
+#include <ks386.inc>
+
+/* Code is taken from wine 1.3.33, 
+ * Copyright Jon Griffiths and Alexandre Julliard
+ */
+EXTERN __chkesp_failed:PROC
+
+PUBLIC __chkesp
+.code
+__chkesp:
+    jnz .test_failed
+    ret
+           
+.test_failed:
+    push  ebp
+    mov ebp, esp
+    sub esp, 12
+    push eax
+    push ecx
+    push edx
+    call __chkesp_failed
+    pop edx
+    pop ecx
+    pop eax
+    leave
+    ret
+    
+END
\ No newline at end of file
index 5566926..0fc725c 100644 (file)
 
 #ifdef __i386__
 
-void _chkesp(void)
-{
-}
-
-#else
-
-void _chkesp(void)
+void _chkesp_failed(void)
 {
+    ERR("stack got corrupted!\n");
+    __debugbreak();
 }
 
 #endif  /* __i386__ */