Commit ab81efa3 authored by Keith Randall's avatar Keith Randall Committed by Keith Randall

runtime: save g register during arm64 race detector callbacks

The race detector C code expects the g register (aka R28) to be
preserved per the C calling convention. Make sure we save/restore it.

Once this is in we can revert the O3 -> O1 change to racebuild.

Change-Id: Ia785b2717c136f565d45bed283e87b744e35c62d
Reviewed-on: https://go-review.googlesource.com/c/go/+/201744Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent f95bf8b6
...@@ -434,13 +434,13 @@ TEXT runtime·racecallbackthunk(SB), NOSPLIT|NOFRAME, $0 ...@@ -434,13 +434,13 @@ TEXT runtime·racecallbackthunk(SB), NOSPLIT|NOFRAME, $0
rest: rest:
// Save callee-saved registers (Go code won't respect that). // Save callee-saved registers (Go code won't respect that).
// 8(RSP) and 16(RSP) are for args passed through racecallback // 8(RSP) and 16(RSP) are for args passed through racecallback
SUB $96, RSP SUB $112, RSP
MOVD LR, 0(RSP) MOVD LR, 0(RSP)
STP (R19, R20), 24(RSP) STP (R19, R20), 24(RSP)
STP (R21, R22), 40(RSP) STP (R21, R22), 40(RSP)
STP (R23, R24), 56(RSP) STP (R23, R24), 56(RSP)
STP (R25, R26), 72(RSP) STP (R25, R26), 72(RSP)
MOVD R27, 88(RSP) STP (R27, g), 88(RSP)
// Set g = g0. // Set g = g0.
// load_g will clobber R0, Save R0 // load_g will clobber R0, Save R0
MOVD R0, R13 MOVD R0, R13
...@@ -463,8 +463,8 @@ rest: ...@@ -463,8 +463,8 @@ rest:
LDP 40(RSP), (R21, R22) LDP 40(RSP), (R21, R22)
LDP 56(RSP), (R23, R24) LDP 56(RSP), (R23, R24)
LDP 72(RSP), (R25, R26) LDP 72(RSP), (R25, R26)
MOVD 88(RSP), R27 LDP 88(RSP), (R27, g)
ADD $96, RSP ADD $112, RSP
JMP (LR) JMP (LR)
// tls_g, g value for each thread in TLS // tls_g, g value for each thread in TLS
......
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