Skip to content

Commit 44e752c

Browse files
committed
runtime: fix ppc64le race code
This code is not currently compiling, the asm vet checks fail. When running race.bash on ppc64le, I get: runtime/race_ppc64le.s:104:1: [ppc64le] RaceReadRange: wrong argument size 24; expected $...-16 runtime/race_ppc64le.s:514:1: [ppc64le] racecallbackthunk: unknown variable cmd; offset 0 is arg+0(FP) runtime/race_ppc64le.s:515:1: [ppc64le] racecallbackthunk: unknown variable ctx I'm also not sure why it ever worked; it looks like it is writing the arguments to racecallback in the wrong place (the race detector itself probably still works, it would just have trouble symbolizing any resulting race report). At a meta-level, we should really add a ppc64le/race builder. Otherwise this code will rot, as evidenced by the rot this CL fixes :) Update #33309 Change-Id: I3b49c2442aa78538fbb631a143a757389a1368fd Reviewed-on: https://go-review.googlesource.com/c/go/+/197337 Run-TryBot: Keith Randall <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Lynn Boger <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 6232dad commit 44e752c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/runtime/race_ppc64le.s

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "go_tls.h"
99
#include "funcdata.h"
1010
#include "textflag.h"
11+
#include "asm_ppc64x.h"
1112

1213
// The following functions allow calling the clang-compiled race runtime directly
1314
// from Go code without going all the way through cgo.
@@ -101,7 +102,7 @@ TEXT runtime·racereadrangepc1(SB), NOSPLIT, $0-24
101102
MOVD $__tsan_read_range(SB), R8
102103
BR racecalladdr<>(SB)
103104

104-
TEXT runtime·RaceReadRange(SB), NOSPLIT, $0-24
105+
TEXT runtime·RaceReadRange(SB), NOSPLIT, $0-16
105106
BR runtime·racereadrange(SB)
106107

107108
// func runtime·RaceWriteRange(addr, size uintptr)
@@ -467,9 +468,9 @@ rest:
467468
MOVD R10, 16(R1)
468469
MOVW CR, R10
469470
MOVW R10, 8(R1)
470-
MOVDU R1, -336(R1) // Allocate frame needed for register save area
471+
MOVDU R1, -336(R1) // Allocate frame needed for outargs and register save area
471472

472-
MOVD R14, 40(R1)
473+
MOVD R14, 328(R1)
473474
MOVD R15, 48(R1)
474475
MOVD R16, 56(R1)
475476
MOVD R17, 64(R1)
@@ -511,16 +512,16 @@ rest:
511512

512513
MOVD g_m(g), R7
513514
MOVD m_g0(R7), g // set g = m-> g0
514-
MOVD R3, cmd+0(FP) // can't use R1 here ?? use input args and assumer caller expects those?
515-
MOVD R4, ctx+8(FP) // can't use R1 here ??
515+
MOVD R3, FIXED_FRAME+0(R1)
516+
MOVD R4, FIXED_FRAME+8(R1)
516517
BL runtime·racecallback(SB)
517518
// All registers are clobbered after Go code, reload.
518519
MOVD runtime·tls_g(SB), R10
519520
MOVD 0(R13)(R10*1), g
520521

521522
MOVD g_m(g), R7
522523
MOVD m_curg(R7), g // restore g = m->curg
523-
MOVD 40(R1), R14
524+
MOVD 328(R1), R14
524525
MOVD 48(R1), R15
525526
MOVD 56(R1), R16
526527
MOVD 64(R1), R17

0 commit comments

Comments
 (0)