[ros-diffs] [hbirr] 15040: Do not modify the stack layout of a function by using inline assembler.

hbirr at svn.reactos.com hbirr at svn.reactos.com
Fri May 6 14:17:31 CEST 2005


Do not modify the stack layout of a function by using inline assembler.
Modified: trunk/reactos/lib/kernel32/process/create.c
  _____  

Modified: trunk/reactos/lib/kernel32/process/create.c
--- trunk/reactos/lib/kernel32/process/create.c	2005-05-06 11:53:35 UTC
(rev 15039)
+++ trunk/reactos/lib/kernel32/process/create.c	2005-05-06 12:17:29 UTC
(rev 15040)
@@ -275,7 +275,6 @@

    return bRetVal;
 }
 
-
 static EXCEPTION_DISPOSITION __cdecl
 _except_handler(EXCEPTION_RECORD *ExceptionRecord,
 		void * EstablisherFrame,
@@ -323,14 +322,34 @@
 		 DWORD lpParameter)
 {
    UINT uExitCode = 0;
+#if 1
+   PVOID OldHandler;
+#endif
 
    DPRINT("BaseProcessStart(..) - setting up exception frame.\n");
 
+#if 1
+   __asm__ __volatile__ ("movl %%fs:0, %0\n\t" \
+                         "movl %1, %%fs:0\n\t" \
+                         : "=r" (OldHandler)
+                         : "r" (_except_handler));
+#else
+   /* FIXME:
+    *   We cannot use push (__try1) and pop (__except1). 
+    *   Gcc doesn't like it, if anyone changes the stack layout.
+    */
    __try1(_except_handler)
+#endif
    {
       uExitCode = (lpStartAddress)((PVOID)lpParameter);
-   } __except1
-
+   } 
+#if 1
+   __asm__ __volatile__ ("movl %0, %%fs:0\n\t" \
+                         : 
+                         : "r" (OldHandler));
+#else
+   __except1
+#endif
    ExitProcess(uExitCode);
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050506/f4461970/attachment.html


More information about the Ros-diffs mailing list