aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_arm.s
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2021-01-31 04:21:47 +1100
committerJoel Sing <joel@sing.id.au>2021-05-09 17:05:25 +0000
commit8ec8f6aa87569a6bc567d4a7039fc22a473b37ec (patch)
treea1fe1f8e3b60aa55f98b0eb4be5ff5bf0253f4a1 /src/runtime/asm_arm.s
parent5203357ebacf9f41ca5e194d953c164049172e96 (diff)
downloadgo-8ec8f6aa87569a6bc567d4a7039fc22a473b37ec.tar.xz
runtime: switch openbsd/arm to pthreads
This switches openbsd/arm to thread creation via pthreads, rather than doing direct system calls. Update #36435 Change-Id: Ia8749e3723a9967905c33b6d93dfd9be797a486c Reviewed-on: https://go-review.googlesource.com/c/go/+/315790 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/asm_arm.s')
-rw-r--r--src/runtime/asm_arm.s13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s
index e779fc8f84..6d3573d68f 100644
--- a/src/runtime/asm_arm.s
+++ b/src/runtime/asm_arm.s
@@ -142,6 +142,11 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
BL runtime·emptyfunc(SB) // fault if stack check is wrong
+#ifdef GOOS_openbsd
+ // Save g to TLS so that it is available from signal trampoline.
+ BL runtime·save_g(SB)
+#endif
+
BL runtime·_initcgo(SB) // will clobber R0-R3
// update stackguard after _cgo_init
@@ -633,9 +638,13 @@ TEXT ·cgocallback(SB),NOSPLIT,$12-12
NO_LOCAL_POINTERS
// Load m and g from thread-local storage.
+#ifdef GOOS_openbsd
+ BL runtime·load_g(SB)
+#else
MOVB runtime·iscgo(SB), R0
CMP $0, R0
BL.NE runtime·load_g(SB)
+#endif
// If g is nil, Go did not create the current thread.
// Call needm to obtain one for temporary use.
@@ -745,6 +754,9 @@ TEXT setg<>(SB),NOSPLIT|NOFRAME,$0-0
#ifdef GOOS_windows
B runtime·save_g(SB)
#else
+#ifdef GOOS_openbsd
+ B runtime·save_g(SB)
+#else
MOVB runtime·iscgo(SB), R0
CMP $0, R0
B.EQ 2(PC)
@@ -753,6 +765,7 @@ TEXT setg<>(SB),NOSPLIT|NOFRAME,$0-0
MOVW g, R0
RET
#endif
+#endif
TEXT runtime·emptyfunc(SB),0,$0-0
RET