diff options
author | Russ Cox <rsc@golang.org> | 2009-11-16 17:51:47 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-11-16 17:51:47 -0800 |
commit | 164130742f2d45c01f55882875842f6e1ecffd49 (patch) | |
tree | 3056afac89e5e5f7d572be0b663fc8d650420af4 | |
parent | c2ade917b6c2cfe76633f9157daf733d96abc183 (diff) | |
download | golang-164130742f2d45c01f55882875842f6e1ecffd49.tar.gz |
runtime: make signal handler work on 386
R=r
http://codereview.appspot.com/154171
-rw-r--r-- | src/pkg/runtime/darwin/386/sys.s | 23 | ||||
-rw-r--r-- | src/pkg/runtime/darwin/os.h | 2 |
2 files changed, 18 insertions, 7 deletions
diff --git a/src/pkg/runtime/darwin/386/sys.s b/src/pkg/runtime/darwin/386/sys.s index 719fcbb5f..66253c99d 100644 --- a/src/pkg/runtime/darwin/386/sys.s +++ b/src/pkg/runtime/darwin/386/sys.s @@ -58,23 +58,34 @@ TEXT sigaction(SB),7,$0 // 16(FP) siginfo // 20(FP) context TEXT sigtramp(SB),7,$40 + // Darwin sets GS to 0x37 on entry. + // The original GS is at 0x70(FP). + MOVL oldgs+0x70(FP), BX + MOVW BX, GS + // g = m->gsignal MOVL m, BP MOVL m_gsignal(BP), BP MOVL BP, g - MOVL handler+4(FP), DI - MOVL signo+12(FP), AX - MOVL siginfo+16(FP), BX - MOVL context+20(FP), 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) MOVL BX, 4(SP) MOVL CX, 8(SP) CALL DI - MOVL context+20(FP), CX - MOVL style+8(FP), BX + // g = m->curg + MOVL m, BP + MOVL m_curg(BP), BP + MOVL BP, g + + MOVL context+16(FP), CX + MOVL style+4(FP), BX MOVL $0, 0(SP) // "caller PC" - ignored MOVL CX, 4(SP) diff --git a/src/pkg/runtime/darwin/os.h b/src/pkg/runtime/darwin/os.h index 2a3ca87bd..2e493aed0 100644 --- a/src/pkg/runtime/darwin/os.h +++ b/src/pkg/runtime/darwin/os.h @@ -17,7 +17,7 @@ uint32 mach_thread_self(void); uint32 mach_thread_self(void); struct Sigaction; -void sigaction(int64, struct Sigaction*, struct Sigaction*); +void sigaction(uintptr, struct Sigaction*, struct Sigaction*); struct StackT; void sigaltstack(struct StackT*, struct StackT*); |