aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/race_amd64.s
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-02-03 12:25:46 -0800
committerKeith Randall <khr@golang.org>2021-02-23 20:06:07 +0000
commita4dac8bd220ff893d7df9cb6fbaf56ecfdd66ad4 (patch)
tree99b7643c9e07e725470204a5e04363d15d4c01d9 /src/runtime/race_amd64.s
parentc49c7a675a2c8ee7591a2d6243255813856b65ce (diff)
downloadgo-a4dac8bd220ff893d7df9cb6fbaf56ecfdd66ad4.tar.gz
go-a4dac8bd220ff893d7df9cb6fbaf56ecfdd66ad4.zip
runtime: use BX instead of R15 in race detector
If the race detector were runnable in dynamic linking mode, then R15 would get clobbered. I don't think it is, so maybe not a problem, but can't hurt to clean it up. It also lets CL 283474 pass cleanly when checking the whole stdlib (together with CL 288452). Change-Id: I5a5021ecc7e7b8bed1cd3a7067c39b24c09e0783 Reviewed-on: https://go-review.googlesource.com/c/go/+/289270 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/race_amd64.s')
-rw-r--r--src/runtime/race_amd64.s10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/runtime/race_amd64.s b/src/runtime/race_amd64.s
index c3b7bbfbfe..e10c21c7f3 100644
--- a/src/runtime/race_amd64.s
+++ b/src/runtime/race_amd64.s
@@ -184,7 +184,7 @@ TEXT runtime·racefuncenter(SB), NOSPLIT, $0-8
// Common code for racefuncenter/racefuncenterfp
// R11 = caller's return address
TEXT racefuncenter<>(SB), NOSPLIT, $0-0
- MOVQ DX, R15 // save function entry context (for closures)
+ MOVQ DX, BX // save function entry context (for closures)
#ifndef GOEXPERIMENT_REGABI
get_tls(R12)
MOVQ g(R12), R14
@@ -193,9 +193,9 @@ TEXT racefuncenter<>(SB), NOSPLIT, $0-0
MOVQ R11, RARG1
// void __tsan_func_enter(ThreadState *thr, void *pc);
MOVQ $__tsan_func_enter(SB), AX
- // racecall<> preserves R15
+ // racecall<> preserves BX
CALL racecall<>(SB)
- MOVQ R15, DX // restore function entry context
+ MOVQ BX, DX // restore function entry context
RET
// func runtime·racefuncexit()
@@ -376,7 +376,7 @@ racecallatomic_ignore:
// Addr is outside the good range.
// Call __tsan_go_ignore_sync_begin to ignore synchronization during the atomic op.
// An attempt to synchronize on the address would cause crash.
- MOVQ AX, R15 // remember the original function
+ MOVQ AX, BX // remember the original function
MOVQ $__tsan_go_ignore_sync_begin(SB), AX
#ifndef GOEXPERIMENT_REGABI
get_tls(R12)
@@ -384,7 +384,7 @@ racecallatomic_ignore:
#endif
MOVQ g_racectx(R14), RARG0 // goroutine context
CALL racecall<>(SB)
- MOVQ R15, AX // restore the original function
+ MOVQ BX, AX // restore the original function
// Call the atomic function.
MOVQ g_racectx(R14), RARG0 // goroutine context
MOVQ 8(SP), RARG1 // caller pc