[project @ 2005-09-11 23:56:24 by wolfgang]
authorwolfgang <unknown>
Sun, 11 Sep 2005 23:56:24 +0000 (23:56 +0000)
committerwolfgang <unknown>
Sun, 11 Sep 2005 23:56:24 +0000 (23:56 +0000)
Darwin/x86:

Align the stack correctly when entering Haskell code.

ghc/rts/StgCRun.c

index 46e573c..c24620a 100644 (file)
@@ -141,14 +141,32 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
         */
        "movl %3,%%ebx\n\t"
        /*
-        * grab the function argument from the stack, and jump to it.
+        * grab the function argument from the stack
         */
         "movl %2,%%eax\n\t"
+        
+#if darwin_TARGET_OS
+       /*
+        * Darwin: keep the stack aligned
+        */
+        "subl $12,%%esp\n\t"
+#endif
+
+       /*
+        * jump to it
+        */
         "jmp *%%eax\n\t"
 
        STG_GLOBAL STG_RETURN "\n"
                STG_RETURN ":\n\t"
 
+#if darwin_TARGET_OS
+       /*
+        * Darwin: keep the stack aligned
+        */
+        "addl $12,%%esp\n\t"
+#endif
+
        "movl %%esi, %%eax\n\t"   /* Return value in R1  */
 
        /*