From a8cca7814a54726a640d2e203133ae27cd070b79 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Sun, 11 Sep 2005 23:56:24 +0000 Subject: [PATCH] [project @ 2005-09-11 23:56:24 by wolfgang] Darwin/x86: Align the stack correctly when entering Haskell code. --- ghc/rts/StgCRun.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ghc/rts/StgCRun.c b/ghc/rts/StgCRun.c index 46e573c..c24620a 100644 --- a/ghc/rts/StgCRun.c +++ b/ghc/rts/StgCRun.c @@ -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 */ /* -- 1.7.10.4