runtime: align stack in sigfwd for darwin/386

We might be forwarding to a C signal handler.  C code expects the stack
to be aligned.  Should fix darwin/386 build: the testcarchive tests were
hanging as the program got an endless series of SIGSEGV signals.

Change-Id: Ia02485d3736a3c40e12259f02d25f842cf8e4d29
Reviewed-on: https://go-review.googlesource.com/19025
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-01-27 22:00:59 -08:00
parent e97096661e
commit 2d916bec96
1 changed files with 13 additions and 7 deletions

View File

@ -242,15 +242,21 @@ TEXT runtime·sigaction(SB),NOSPLIT,$0
MOVL $0xf1, 0xf1 // crash
RET
TEXT runtime·sigfwd(SB),NOSPLIT,$12-16
MOVL sig+4(FP), AX
MOVL AX, 0(SP)
MOVL info+8(FP), AX
MOVL AX, 4(SP)
MOVL ctx+12(FP), AX
MOVL AX, 8(SP)
TEXT runtime·sigfwd(SB),NOSPLIT,$0-16
MOVL fn+0(FP), AX
MOVL sig+4(FP), BX
MOVL info+8(FP), CX
MOVL ctx+12(FP), DX
MOVL SP, SI
SUBL $32, SP // align stack; handler might be C code
ANDL $~15, SP
MOVL BX, 0(SP)
MOVL CX, 4(SP)
MOVL DX, 8(SP)
MOVL SI, 12(SP)
CALL AX
MOVL 12(SP), AX
MOVL AX, SP
RET
TEXT runtime·sigreturn(SB),NOSPLIT,$12-8