Skip to content

Commit

Permalink
[dev.regabi] runtime: zero X15 in racecall
Browse files Browse the repository at this point in the history
racecall can be called in ABIInternal context (e.g. raceread
calling racecalladdr calling racecall) without wrapper. racecall
calls C code, which doesn't preserve our special registers. Set
them explicitly in racecall upon returning from C.

Change-Id: Ic990479c1fca6bb8a3b151325c7a89be8331a530
Reviewed-on: https://go-review.googlesource.com/c/go/+/289709
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
  • Loading branch information
cherrymui committed Feb 5, 2021
1 parent 397a46a commit 946351d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/race_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ call:
ANDQ $~15, SP // alignment for gcc ABI
CALL AX
MOVQ R12, SP
// Back to Go world, set special registers.
// The g register (R14) is preserved in C.
XORPS X15, X15
RET

// C->Go callback thunk that allows to call runtime·racesymbolize from C code.
Expand Down

0 comments on commit 946351d

Please sign in to comment.