1
0
mirror of https://github.com/golang/go synced 2024-11-18 01:34:44 -07:00

runtime: don't use R11 in nanotime1/walltime1 on ARM

R11 a.k.a. REGTMP is the temp register used by the assembler. It
may be clobbered if the assembler needs to synthesize
instructions. In particular, in nanotime1/walltime1, the load of
global variable runtime.iscgo clobbers it. So, avoid using R11
to hold a long-lived value.

Fixes #36309.

Change-Id: Iec2ab9d664532cad8fbf58da17f580e64a744f62
Reviewed-on: https://go-review.googlesource.com/c/go/+/212641
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Andrew G. Morgan <agm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Cherry Zhang 2019-12-30 11:26:17 -05:00
parent 9df93e4d6d
commit 2ee2c6232c

View File

@ -269,8 +269,8 @@ noswitch:
MOVW $CLOCK_REALTIME, R0
MOVW $8(R13), R1 // timespec
MOVW runtime·vdsoClockgettimeSym(SB), R11
CMP $0, R11
MOVW runtime·vdsoClockgettimeSym(SB), R2
CMP $0, R2
B.EQ fallback
// Store g on gsignal's stack, so if we receive a signal
@ -292,7 +292,7 @@ noswitch:
MOVW (g_stack+stack_lo)(R6), R6 // g.m.gsignal.stack.lo
MOVW g, (R6)
BL (R11)
BL (R2)
MOVW $0, R1
MOVW R1, (R6) // clear g slot, R6 is unchanged by C code
@ -300,7 +300,7 @@ noswitch:
JMP finish
nosaveg:
BL (R11)
BL (R2)
JMP finish
fallback:
@ -347,8 +347,8 @@ noswitch:
MOVW $CLOCK_MONOTONIC, R0
MOVW $8(R13), R1 // timespec
MOVW runtime·vdsoClockgettimeSym(SB), R11
CMP $0, R11
MOVW runtime·vdsoClockgettimeSym(SB), R2
CMP $0, R2
B.EQ fallback
// Store g on gsignal's stack, so if we receive a signal
@ -370,7 +370,7 @@ noswitch:
MOVW (g_stack+stack_lo)(R6), R6 // g.m.gsignal.stack.lo
MOVW g, (R6)
BL (R11)
BL (R2)
MOVW $0, R1
MOVW R1, (R6) // clear g slot, R6 is unchanged by C code
@ -378,7 +378,7 @@ noswitch:
JMP finish
nosaveg:
BL (R11)
BL (R2)
JMP finish
fallback: