diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-04-20 15:44:41 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-04-20 15:44:41 +0200 |
commit | 50104cc32a498f7517a51c8dc93106c51c7a54b4 (patch) | |
tree | 47af80be259cc7c45d0eaec7d42e61fa38c8e4fb /src/pkg/runtime/darwin/386 | |
parent | c072558b90f1bbedc2022b0f30c8b1ac4712538e (diff) | |
download | golang-upstream/2011.03.07.1.tar.gz |
Imported Upstream version 2011.03.07.1upstream/2011.03.07.1
Diffstat (limited to 'src/pkg/runtime/darwin/386')
-rw-r--r-- | src/pkg/runtime/darwin/386/signal.c | 10 | ||||
-rw-r--r-- | src/pkg/runtime/darwin/386/sys.s | 29 |
2 files changed, 19 insertions, 20 deletions
diff --git a/src/pkg/runtime/darwin/386/signal.c b/src/pkg/runtime/darwin/386/signal.c index 33f47d44f..aeef5de3f 100644 --- a/src/pkg/runtime/darwin/386/signal.c +++ b/src/pkg/runtime/darwin/386/signal.c @@ -34,20 +34,19 @@ runtime·signame(int32 sig) } void -runtime·sighandler(int32 sig, Siginfo *info, void *context) +runtime·sighandler(int32 sig, Siginfo *info, void *context, G *gp) { Ucontext *uc; Mcontext *mc; Regs *r; uintptr *sp; - G *gp; byte *pc; uc = context; mc = uc->uc_mcontext; r = &mc->ss; - if((gp = m->curg) != nil && (runtime·sigtab[sig].flags & SigPanic)) { + if(gp != nil && (runtime·sigtab[sig].flags & SigPanic)) { // Work around Leopard bug that doesn't set FPE_INTDIV. // Look at instruction to see if it is a divide. // Not necessary in Snow Leopard (si_code will be != 0). @@ -103,12 +102,11 @@ runtime·sighandler(int32 sig, Siginfo *info, void *context) runtime·printf("\n"); if(runtime·gotraceback()){ - runtime·traceback((void*)r->eip, (void*)r->esp, 0, m->curg); - runtime·tracebackothers(m->curg); + runtime·traceback((void*)r->eip, (void*)r->esp, 0, gp); + runtime·tracebackothers(gp); runtime·dumpregs(r); } - runtime·breakpoint(); runtime·exit(2); } diff --git a/src/pkg/runtime/darwin/386/sys.s b/src/pkg/runtime/darwin/386/sys.s index 7961e369c..9d2caca0a 100644 --- a/src/pkg/runtime/darwin/386/sys.s +++ b/src/pkg/runtime/darwin/386/sys.s @@ -80,33 +80,34 @@ TEXT runtime·sigtramp(SB),7,$40 get_tls(CX) // save g - MOVL g(CX), BP - MOVL BP, 20(SP) + MOVL g(CX), DI + MOVL DI, 20(SP) // g = m->gsignal MOVL m(CX), BP MOVL m_gsignal(BP), BP MOVL BP, g(CX) - MOVL handler+0(FP), DI - // 4(FP) is sigstyle - MOVL signo+8(FP), AX - MOVL siginfo+12(FP), BX - MOVL context+16(FP), CX - - MOVL AX, 0(SP) + // copy arguments to sighandler + MOVL sig+8(FP), BX + MOVL BX, 0(SP) + MOVL info+12(FP), BX MOVL BX, 4(SP) - MOVL CX, 8(SP) - CALL DI + MOVL context+16(FP), BX + MOVL BX, 8(SP) + MOVL DI, 12(SP) + + MOVL handler+0(FP), BX + CALL BX // restore g get_tls(CX) - MOVL 20(SP), BP - MOVL BP, g(CX) + MOVL 20(SP), DI + MOVL DI, g(CX) + // call sigreturn MOVL context+16(FP), CX MOVL style+4(FP), BX - MOVL $0, 0(SP) // "caller PC" - ignored MOVL CX, 4(SP) MOVL BX, 8(SP) |