mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
runtime: windows_386 sighandler to use correct g
Fixes #2403. R=hectorchu CC=golang-dev https://golang.org/cl/5309071
This commit is contained in:
parent
bbd173fc3d
commit
603d80c28d
|
@ -31,12 +31,9 @@ runtime·initsig(int32)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
runtime·sighandler(ExceptionRecord *info, void *frame, Context *r)
|
runtime·sighandler(ExceptionRecord *info, Context *r, G *gp)
|
||||||
{
|
{
|
||||||
uintptr *sp;
|
uintptr *sp;
|
||||||
G *gp;
|
|
||||||
|
|
||||||
USED(frame);
|
|
||||||
|
|
||||||
switch(info->ExceptionCode) {
|
switch(info->ExceptionCode) {
|
||||||
case EXCEPTION_BREAKPOINT:
|
case EXCEPTION_BREAKPOINT:
|
||||||
|
@ -44,7 +41,7 @@ runtime·sighandler(ExceptionRecord *info, void *frame, Context *r)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((gp = m->curg) != nil && runtime·issigpanic(info->ExceptionCode)) {
|
if(gp != nil && runtime·issigpanic(info->ExceptionCode)) {
|
||||||
// Make it look like a call to the signal func.
|
// Make it look like a call to the signal func.
|
||||||
// Have to pass arguments out of band since
|
// Have to pass arguments out of band since
|
||||||
// augmenting the stack frame would break
|
// augmenting the stack frame would break
|
||||||
|
|
|
@ -48,51 +48,33 @@ TEXT runtime·setlasterror(SB),7,$0
|
||||||
MOVL AX, 0x34(FS)
|
MOVL AX, 0x34(FS)
|
||||||
RET
|
RET
|
||||||
|
|
||||||
TEXT runtime·sigtramp(SB),7,$0
|
TEXT runtime·sigtramp(SB),7,$28
|
||||||
PUSHL BP // cdecl
|
|
||||||
PUSHL BX
|
|
||||||
PUSHL SI
|
|
||||||
PUSHL DI
|
|
||||||
PUSHL 0(FS)
|
|
||||||
CALL runtime·sigtramp1(SB)
|
|
||||||
POPL 0(FS)
|
|
||||||
POPL DI
|
|
||||||
POPL SI
|
|
||||||
POPL BX
|
|
||||||
POPL BP
|
|
||||||
RET
|
|
||||||
|
|
||||||
TEXT runtime·sigtramp1(SB),0,$16-40
|
|
||||||
// unwinding?
|
// unwinding?
|
||||||
MOVL info+24(FP), BX
|
MOVL info+0(FP), CX
|
||||||
MOVL 4(BX), CX // exception flags
|
TESTL $6, 4(CX) // exception flags
|
||||||
ANDL $6, CX
|
|
||||||
MOVL $1, AX
|
MOVL $1, AX
|
||||||
JNZ sigdone
|
JNZ sigdone
|
||||||
|
|
||||||
// place ourselves at the top of the SEH chain to
|
|
||||||
// ensure SEH frames lie within thread stack bounds
|
|
||||||
MOVL frame+28(FP), CX // our SEH frame
|
|
||||||
MOVL CX, 0(FS)
|
|
||||||
|
|
||||||
// copy arguments for call to sighandler
|
// copy arguments for call to sighandler
|
||||||
MOVL BX, 0(SP)
|
MOVL CX, 0(SP)
|
||||||
|
MOVL context+8(FP), CX
|
||||||
MOVL CX, 4(SP)
|
MOVL CX, 4(SP)
|
||||||
MOVL context+32(FP), BX
|
get_tls(CX)
|
||||||
MOVL BX, 8(SP)
|
MOVL g(CX), CX
|
||||||
MOVL dispatcher+36(FP), BX
|
MOVL CX, 8(SP)
|
||||||
|
|
||||||
MOVL BX, 12(SP)
|
MOVL BX, 12(SP)
|
||||||
|
MOVL BP, 16(SP)
|
||||||
|
MOVL SI, 20(SP)
|
||||||
|
MOVL DI, 24(SP)
|
||||||
|
|
||||||
CALL runtime·sighandler(SB)
|
CALL runtime·sighandler(SB)
|
||||||
TESTL AX, AX
|
// AX is set to report result back to Windows
|
||||||
JZ sigdone
|
|
||||||
|
|
||||||
// call windows default handler early
|
|
||||||
MOVL 4(SP), BX // our SEH frame
|
|
||||||
MOVL 0(BX), BX // SEH frame of default handler
|
|
||||||
MOVL BX, 4(SP) // set establisher frame
|
|
||||||
CALL 4(BX)
|
|
||||||
|
|
||||||
|
MOVL 24(SP), DI
|
||||||
|
MOVL 20(SP), SI
|
||||||
|
MOVL 16(SP), BP
|
||||||
|
MOVL 12(SP), BX
|
||||||
sigdone:
|
sigdone:
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue