runtime: fix a register save/restore bug in sigtramp of arm-darwin

In sigtramp of sys_darwin_arm.s, the callee-save register R4 is
saved to the stack, but later R2 is also saved to the save position.

That CL fixes the unexpected lost of the value in R4.

fixes #32744

Change-Id: Ifaeb99f11e4abf0c79bec9da67e0db97c358010c
Reviewed-on: https://go-review.googlesource.com/c/go/+/183517
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Ben Shi 2019-06-24 02:17:40 +00:00
parent d1d9ad583d
commit df901bce5e
1 changed files with 14 additions and 14 deletions

View File

@ -160,14 +160,14 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-16
TEXT runtime·sigtramp(SB),NOSPLIT,$0
// Reserve space for callee-save registers and arguments.
SUB $36, R13
SUB $40, R13
MOVW R4, 12(R13)
MOVW R5, 16(R13)
MOVW R6, 20(R13)
MOVW R7, 24(R13)
MOVW R8, 28(R13)
MOVW R11, 32(R13)
MOVW R4, 16(R13)
MOVW R5, 20(R13)
MOVW R6, 24(R13)
MOVW R7, 28(R13)
MOVW R8, 32(R13)
MOVW R11, 36(R13)
// Save arguments.
MOVW R0, 4(R13) // sig
@ -216,14 +216,14 @@ nog:
MOVW R5, R13
// Restore callee-save registers.
MOVW 12(R13), R4
MOVW 16(R13), R5
MOVW 20(R13), R6
MOVW 24(R13), R7
MOVW 28(R13), R8
MOVW 32(R13), R11
MOVW 16(R13), R4
MOVW 20(R13), R5
MOVW 24(R13), R6
MOVW 28(R13), R7
MOVW 32(R13), R8
MOVW 36(R13), R11
ADD $36, R13
ADD $40, R13
RET