Skip to content

Commit

Permalink
runtime: avoid clobbering C callee-save register in cgoSigtramp
Browse files Browse the repository at this point in the history
Use R11 (a caller-saved temp register) instead of RBX (a callee-saved
register).

I believe this only affects linux/amd64, since it is the only platform
with a non-trivial cgoSigtramp implementation.

Updates #18328.

Change-Id: I3d35c4512624184d5a8ece653fa09ddf50e079a2
Reviewed-on: https://go-review.googlesource.com/35068
Reviewed-by: Ian Lance Taylor <[email protected]>
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
Bryan C. Mills authored and ianlancetaylor committed Jan 12, 2017
1 parent f65abf6 commit fdde7ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/sys_linux_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ sigtrampnog:
// Lock sigprofCallersUse.
MOVL $0, AX
MOVL $1, CX
MOVQ $runtime·sigprofCallersUse(SB), BX
MOVQ $runtime·sigprofCallersUse(SB), R11
LOCK
CMPXCHGL CX, 0(BX)
CMPXCHGL CX, 0(R11)
JNZ sigtramp // Skip stack trace if already locked.

// Jump to the traceback function in runtime/cgo.
Expand Down

0 comments on commit fdde7ba

Please sign in to comment.