X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FStgCRun.c;h=fb7179f75eff1e43d2f239c5c5bee0c5f3081b54;hb=2a86ebc211c02271fa035f5834eb9f0b2e3bd6e5;hp=f88f28ee8923f4421c887ea6ec97f98494c2420c;hpb=0bffc410964e1688ad80d277d53400659e697ab5;p=ghc-hetmet.git diff --git a/ghc/rts/StgCRun.c b/ghc/rts/StgCRun.c index f88f28e..fb7179f 100644 --- a/ghc/rts/StgCRun.c +++ b/ghc/rts/StgCRun.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: StgCRun.c,v 1.37 2002/12/11 15:36:51 simonmar Exp $ + * $Id: StgCRun.c,v 1.39 2003/06/09 13:17:41 matthewc Exp $ * * (c) The GHC Team, 1998-2000 * @@ -472,18 +472,18 @@ static void StgRunIsImplementedInAssembler(void) "_StgRun:\n" "\tmflr r0\n" "\tbl saveFP # f14\n" - "\tstmw r14,-216(r1)\n" - "\tstwu r1,-8480(r1)\n" + "\tstmw r13,-220(r1)\n" + "\tstwu r1,-%0(r1)\n" "\tmtctr r3\n" "\tmr r12,r3\n" "\tbctr\n" ".globl _StgReturn\n" "_StgReturn:\n" "\tmr r3,r14\n" - "\tla r1,8480(r1)\n" - "\tlmw r14,-216(r1)\n" + "\tla r1,%0(r1)\n" + "\tlmw r13,-220(r1)\n" "\tb restFP # f14\n" - ); /* RESERVED_C_STACK_BYTES + stack frame size == 8192 + 288 == 8480 */ + : : "i"(RESERVED_C_STACK_BYTES+288 /*stack frame size*/)); } #endif @@ -498,6 +498,7 @@ static void StgRunIsImplementedInAssembler(void) loc16 - loc28: STG registers loc29: saved ar.pfs loc30: saved b0 + loc31: saved gp (gcc 3.3 uses this slot) -------------------------------------------------------------------------- */ #ifdef ia64_TARGET_ARCH @@ -506,12 +507,19 @@ static void StgRunIsImplementedInAssembler(void) #undef RESERVED_C_STACK_BYTES #define RESERVED_C_STACK_BYTES 1024 +#if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +/* gcc 3.3+: leave an extra slot for gp saves */ +#define LOCALS 32 +#else +#define LOCALS 31 +#endif + static void StgRunIsImplementedInAssembler(void) { __asm__ volatile( ".global StgRun\n" "StgRun:\n" - "\talloc loc29 = ar.pfs, 0, 31, 8, 0\n" /* setup register frame */ + "\talloc loc29 = ar.pfs, 0, %1, 8, 0\n" /* setup register frame */ "\tld8 r18 = [r32],8\n" /* get procedure address */ "\tadds sp = -%0, sp ;;\n" /* setup stack */ "\tld8 gp = [r32]\n" /* get procedure GP */ @@ -541,7 +549,7 @@ static void StgRunIsImplementedInAssembler(void) "\tldf.fill f21 = [r17],32\n" "\tadds sp = %0, sp\n" /* restore stack */ "\tbr.ret.sptk.many b0 ;;\n" /* return */ - : : "i"(RESERVED_C_STACK_BYTES + 6*16)); + : : "i"(RESERVED_C_STACK_BYTES + 6*16), "i"(LOCALS)); } #endif