diff options
Diffstat (limited to 'src/pkg/runtime/freebsd/amd64')
-rw-r--r-- | src/pkg/runtime/freebsd/amd64/signal.c | 10 | ||||
-rw-r--r-- | src/pkg/runtime/freebsd/amd64/sys.s | 24 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/pkg/runtime/freebsd/amd64/signal.c b/src/pkg/runtime/freebsd/amd64/signal.c index 9f873d276..f145371b4 100644 --- a/src/pkg/runtime/freebsd/amd64/signal.c +++ b/src/pkg/runtime/freebsd/amd64/signal.c @@ -53,17 +53,16 @@ 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 *r; - G *gp; uintptr *sp; uc = context; r = &uc->uc_mcontext; - if((gp = m->curg) != nil && (runtime·sigtab[sig].flags & SigPanic)) { + if(gp != nil && (runtime·sigtab[sig].flags & SigPanic)) { // Make it look like a call to the signal func. // Have to pass arguments out of band since // augmenting the stack frame would break @@ -107,12 +106,11 @@ runtime·sighandler(int32 sig, Siginfo* info, void* context) runtime·printf("\n"); if(runtime·gotraceback()){ - runtime·traceback((void*)r->mc_rip, (void*)r->mc_rsp, 0, g); - runtime·tracebackothers(g); + runtime·traceback((void*)r->mc_rip, (void*)r->mc_rsp, 0, gp); + runtime·tracebackothers(gp); runtime·dumpregs(r); } - runtime·breakpoint(); runtime·exit(2); } diff --git a/src/pkg/runtime/freebsd/amd64/sys.s b/src/pkg/runtime/freebsd/amd64/sys.s index b9cf3832d..d986e9ac0 100644 --- a/src/pkg/runtime/freebsd/amd64/sys.s +++ b/src/pkg/runtime/freebsd/amd64/sys.s @@ -90,15 +90,29 @@ TEXT runtime·sigaction(SB),7,$-8 CALL runtime·notok(SB) RET -TEXT runtime·sigtramp(SB),7,$24-16 - get_tls(CX) - MOVQ m(CX), AX - MOVQ m_gsignal(AX), AX - MOVQ AX, g(CX) +TEXT runtime·sigtramp(SB),7,$64 + get_tls(BX) + + // save g + MOVQ g(BX), R10 + MOVQ R10, 40(SP) + + // g = m->signal + MOVQ m(BX), BP + MOVQ m_gsignal(BP), BP + MOVQ BP, g(BX) + MOVQ DI, 0(SP) MOVQ SI, 8(SP) MOVQ DX, 16(SP) + MOVQ R10, 24(SP) + CALL runtime·sighandler(SB) + + // restore g + get_tls(BX) + MOVQ 40(SP), R10 + MOVQ R10, g(BX) RET TEXT runtime·mmap(SB),7,$0 |