Commit c548cc2e authored by Russ Cox's avatar Russ Cox

runtime: fix windows signal handlers

Windows needs the return result in AX, but runtime.sighandler
no longer stores it in AX. Load it back during the assembly trampoline.

TBR=brainman
CC=golang-codereviews
https://golang.org/cl/133980043
parent fe91006a
......@@ -76,10 +76,10 @@ TEXT runtime·setlasterror(SB),NOSPLIT,$0
// Return 0 for 'not handled', -1 for handled.
TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
MOVL ptrs+0(FP), CX
SUBL $28, SP
SUBL $32, SP
// save callee-saved registers
MOVL BX, 12(SP)
MOVL BX, 28(SP)
MOVL BP, 16(SP)
MOVL SI, 20(SP)
MOVL DI, 24(SP)
......@@ -103,15 +103,16 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
MOVL DX, 8(SP)
CALL runtime·sighandler(SB)
// AX is set to report result back to Windows
MOVL 12(SP), AX
done:
// restore callee-saved registers
MOVL 24(SP), DI
MOVL 20(SP), SI
MOVL 16(SP), BP
MOVL 12(SP), BX
MOVL 28(SP), BX
ADDL $28, SP
ADDL $32, SP
// RET 4 (return and pop 4 bytes parameters)
BYTE $0xC2; WORD $4
RET // unreached; make assembler happy
......
......@@ -106,7 +106,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
// DI SI BP BX R12 R13 R14 R15 registers and DF flag are preserved
// as required by windows callback convention.
PUSHFQ
SUBQ $88, SP
SUBQ $96, SP
MOVQ DI, 80(SP)
MOVQ SI, 72(SP)
MOVQ BP, 64(SP)
......@@ -114,7 +114,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
MOVQ R12, 48(SP)
MOVQ R13, 40(SP)
MOVQ R14, 32(SP)
MOVQ R15, 24(SP)
MOVQ R15, 88(SP)
MOVQ 0(CX), BX // ExceptionRecord*
MOVQ 8(CX), CX // Context*
......@@ -135,10 +135,11 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
MOVQ DX, 16(SP)
CALL runtime·sighandler(SB)
// AX is set to report result back to Windows
MOVL 24(SP), AX
done:
// restore registers as required for windows callback
MOVQ 24(SP), R15
MOVQ 88(SP), R15
MOVQ 32(SP), R14
MOVQ 40(SP), R13
MOVQ 48(SP), R12
......@@ -146,7 +147,7 @@ done:
MOVQ 64(SP), BP
MOVQ 72(SP), SI
MOVQ 80(SP), DI
ADDQ $88, SP
ADDQ $96, SP
POPFQ
RET
......
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