aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_arm.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/sys_linux_arm.s')
-rw-r--r--src/runtime/sys_linux_arm.s30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s
index 9ef8c9258b..b8dc202d4c 100644
--- a/src/runtime/sys_linux_arm.s
+++ b/src/runtime/sys_linux_arm.s
@@ -277,21 +277,28 @@ noswitch:
// during VDSO code we can find the g.
// If we don't have a signal stack, we won't receive signal,
// so don't bother saving g.
+ // When using cgo, we already saved g on TLS, also don't save
+ // g here.
+ MOVB runtime·iscgo(SB), R6
+ CMP $0, R6
+ BNE nosaveg
MOVW m_gsignal(R5), R6 // g.m.gsignal
CMP $0, R6
- BEQ 3(PC)
+ BEQ nosaveg
MOVW (g_stack+stack_lo)(R6), R6 // g.m.gsignal.stack.lo
MOVW g, (R6)
BL (R11)
- CMP $0, R6 // R6 is unchanged by C code
- BEQ 3(PC)
MOVW $0, R1
- MOVW R1, (R6) // clear g slot
+ MOVW R1, (R6) // clear g slot, R6 is unchanged by C code
JMP finish
+nosaveg:
+ BL (R11)
+ JMP finish
+
fallback:
MOVW $SYS_clock_gettime, R7
SWI $0
@@ -344,21 +351,28 @@ noswitch:
// during VDSO code we can find the g.
// If we don't have a signal stack, we won't receive signal,
// so don't bother saving g.
+ // When using cgo, we already saved g on TLS, also don't save
+ // g here.
+ MOVB runtime·iscgo(SB), R6
+ CMP $0, R6
+ BNE nosaveg
MOVW m_gsignal(R5), R6 // g.m.gsignal
CMP $0, R6
- BEQ 3(PC)
+ BEQ nosaveg
MOVW (g_stack+stack_lo)(R6), R6 // g.m.gsignal.stack.lo
MOVW g, (R6)
BL (R11)
- CMP $0, R6 // R6 is unchanged by C code
- BEQ 3(PC)
MOVW $0, R1
- MOVW R1, (R6) // clear g slot
+ MOVW R1, (R6) // clear g slot, R6 is unchanged by C code
JMP finish
+nosaveg:
+ BL (R11)
+ JMP finish
+
fallback:
MOVW $SYS_clock_gettime, R7
SWI $0