Commit 597b2a91 authored by Russ Cox's avatar Russ Cox

runtime: make signal handler work on 386

R=r
https://golang.org/cl/154171
parent 1ee83f85
...@@ -58,23 +58,34 @@ TEXT sigaction(SB),7,$0 ...@@ -58,23 +58,34 @@ TEXT sigaction(SB),7,$0
// 16(FP) siginfo // 16(FP) siginfo
// 20(FP) context // 20(FP) context
TEXT sigtramp(SB),7,$40 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 // g = m->gsignal
MOVL m, BP MOVL m, BP
MOVL m_gsignal(BP), BP MOVL m_gsignal(BP), BP
MOVL BP, g MOVL BP, g
MOVL handler+4(FP), DI MOVL handler+0(FP), DI
MOVL signo+12(FP), AX // 4(FP) is sigstyle
MOVL siginfo+16(FP), BX MOVL signo+8(FP), AX
MOVL context+20(FP), CX MOVL siginfo+12(FP), BX
MOVL context+16(FP), CX
MOVL AX, 0(SP) MOVL AX, 0(SP)
MOVL BX, 4(SP) MOVL BX, 4(SP)
MOVL CX, 8(SP) MOVL CX, 8(SP)
CALL DI CALL DI
MOVL context+20(FP), CX // g = m->curg
MOVL style+8(FP), BX 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 $0, 0(SP) // "caller PC" - ignored
MOVL CX, 4(SP) MOVL CX, 4(SP)
......
...@@ -17,7 +17,7 @@ uint32 mach_thread_self(void); ...@@ -17,7 +17,7 @@ uint32 mach_thread_self(void);
uint32 mach_thread_self(void); uint32 mach_thread_self(void);
struct Sigaction; struct Sigaction;
void sigaction(int64, struct Sigaction*, struct Sigaction*); void sigaction(uintptr, struct Sigaction*, struct Sigaction*);
struct StackT; struct StackT;
void sigaltstack(struct StackT*, struct StackT*); void sigaltstack(struct StackT*, struct StackT*);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment