aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Shi <powerman1st@163.com>2019-06-24 02:17:40 +0000
committerBen Shi <powerman1st@163.com>2019-06-25 01:48:46 +0000
commitdf901bce5ed71132f5837b513663fec889d82731 (patch)
treedb2ad90a2d9b5130637cf3fec787878bbb4abfe4
parentd1d9ad583df5d6dc58028e1303ddeccb39237220 (diff)
downloadgo-df901bce5ed71132f5837b513663fec889d82731.tar.gz
go-df901bce5ed71132f5837b513663fec889d82731.zip
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>
-rw-r--r--src/runtime/sys_darwin_arm.s30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/runtime/sys_darwin_arm.s b/src/runtime/sys_darwin_arm.s
index 82470bc4df..b1c22b3242 100644
--- a/src/runtime/sys_darwin_arm.s
+++ b/src/runtime/sys_darwin_arm.s
@@ -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
-
- ADD $36, R13
+ 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 $40, R13
RET