summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/darwin/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/darwin/amd64')
-rw-r--r--src/pkg/runtime/darwin/amd64/signal.c10
-rw-r--r--src/pkg/runtime/darwin/amd64/sys.s19
2 files changed, 15 insertions, 14 deletions
diff --git a/src/pkg/runtime/darwin/amd64/signal.c b/src/pkg/runtime/darwin/amd64/signal.c
index 948b6c9c2..402ab33ca 100644
--- a/src/pkg/runtime/darwin/amd64/signal.c
+++ b/src/pkg/runtime/darwin/amd64/signal.c
@@ -42,12 +42,11 @@ 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;
- G *gp;
uintptr *sp;
byte *pc;
@@ -55,7 +54,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *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).
@@ -113,12 +112,11 @@ runtime·sighandler(int32 sig, Siginfo *info, void *context)
runtime·printf("\n");
if(runtime·gotraceback()){
- runtime·traceback((void*)r->rip, (void*)r->rsp, 0, g);
- runtime·tracebackothers(g);
+ runtime·traceback((void*)r->rip, (void*)r->rsp, 0, gp);
+ runtime·tracebackothers(gp);
runtime·dumpregs(r);
}
- runtime·breakpoint();
runtime·exit(2);
}
diff --git a/src/pkg/runtime/darwin/amd64/sys.s b/src/pkg/runtime/darwin/amd64/sys.s
index bc970156a..4f9e0d77a 100644
--- a/src/pkg/runtime/darwin/amd64/sys.s
+++ b/src/pkg/runtime/darwin/amd64/sys.s
@@ -66,8 +66,8 @@ TEXT runtime·sigtramp(SB),7,$64
get_tls(BX)
// save g
- MOVQ g(BX), BP
- MOVQ BP, 40(SP)
+ MOVQ g(BX), R10
+ MOVQ R10, 48(SP)
// g = m->gsignal
MOVQ m(BX), BP
@@ -77,18 +77,21 @@ TEXT runtime·sigtramp(SB),7,$64
MOVL DX, 0(SP)
MOVQ CX, 8(SP)
MOVQ R8, 16(SP)
- MOVQ R8, 24(SP) // save ucontext
- MOVQ SI, 32(SP) // save infostyle
+ MOVQ R10, 24(SP)
+
+ MOVQ R8, 32(SP) // save ucontext
+ MOVQ SI, 40(SP) // save infostyle
CALL DI
// restore g
get_tls(BX)
- MOVQ 40(SP), BP
- MOVQ BP, g(BX)
+ MOVQ 48(SP), R10
+ MOVQ R10, g(BX)
+ // call sigreturn
MOVL $(0x2000000+184), AX // sigreturn(ucontext, infostyle)
- MOVQ 24(SP), DI // saved ucontext
- MOVQ 32(SP), SI // saved infostyle
+ MOVQ 32(SP), DI // saved ucontext
+ MOVQ 40(SP), SI // saved infostyle
SYSCALL
INT $3 // not reached