aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2021-01-26 17:52:19 +1100
committerJoel Sing <joel@sing.id.au>2021-01-27 12:01:46 +0000
commit6c8fbfbdcfa48ca29926097b20767fe83409b3ed (patch)
tree66d041d521a8687e5881c166b60895e97d881e26
parent5cdf0da1bfc74ad1017a488044a865850f7c3c8e (diff)
downloadgo-6c8fbfbdcfa48ca29926097b20767fe83409b3ed.tar.gz
go-6c8fbfbdcfa48ca29926097b20767fe83409b3ed.zip
runtime: convert openbsd/arm64 locking to libc
Switch openbsd/arm64 to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I2f30432c4bc232224cf87dca750665b8c40c7b72 Reviewed-on: https://go-review.googlesource.com/c/go/+/286813 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
-rw-r--r--src/runtime/os_openbsd_syscall1.go2
-rw-r--r--src/runtime/sys_openbsd1.go2
-rw-r--r--src/runtime/sys_openbsd_arm64.s43
3 files changed, 21 insertions, 26 deletions
diff --git a/src/runtime/os_openbsd_syscall1.go b/src/runtime/os_openbsd_syscall1.go
index 08928cfef4..b0bef4c504 100644
--- a/src/runtime/os_openbsd_syscall1.go
+++ b/src/runtime/os_openbsd_syscall1.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build openbsd,!amd64
+// +build openbsd,!amd64,!arm64
package runtime
diff --git a/src/runtime/sys_openbsd1.go b/src/runtime/sys_openbsd1.go
index a201a16c53..e2886218db 100644
--- a/src/runtime/sys_openbsd1.go
+++ b/src/runtime/sys_openbsd1.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build openbsd,amd64
+// +build openbsd,amd64 openbsd,arm64
package runtime
diff --git a/src/runtime/sys_openbsd_arm64.s b/src/runtime/sys_openbsd_arm64.s
index 2ec9d038ba..7e454a9867 100644
--- a/src/runtime/sys_openbsd_arm64.s
+++ b/src/runtime/sys_openbsd_arm64.s
@@ -188,6 +188,25 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0
ADD $16, RSP
RET
+TEXT runtime·thrsleep_trampoline(SB),NOSPLIT,$0
+ MOVW 8(R0), R1 // arg 2 - clock_id
+ MOVD 16(R0), R2 // arg 3 - abstime
+ MOVD 24(R0), R3 // arg 4 - lock
+ MOVD 32(R0), R4 // arg 5 - abort
+ MOVD 0(R0), R0 // arg 1 - id
+ CALL libc_thrsleep(SB)
+ RET
+
+TEXT runtime·thrwakeup_trampoline(SB),NOSPLIT,$0
+ MOVW 8(R0), R1 // arg 2 - count
+ MOVD 0(R0), R0 // arg 1 - id
+ CALL libc_thrwakeup(SB)
+ RET
+
+TEXT runtime·sched_yield_trampoline(SB),NOSPLIT,$0
+ CALL libc_sched_yield(SB)
+ RET
+
// Exit the entire program (like C exit)
TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0
MOVW code+0(FP), R0 // arg 1 - status
@@ -422,30 +441,6 @@ TEXT runtime·sigaltstack(SB),NOSPLIT,$0
MOVD R8, (R8)
RET
-TEXT runtime·osyield(SB),NOSPLIT,$0
- MOVD $298, R8 // sys_sched_yield
- INVOKE_SYSCALL
- RET
-
-TEXT runtime·thrsleep(SB),NOSPLIT,$0
- MOVD ident+0(FP), R0 // arg 1 - ident
- MOVW clock_id+8(FP), R1 // arg 2 - clock_id
- MOVD tsp+16(FP), R2 // arg 3 - tsp
- MOVD lock+24(FP), R3 // arg 4 - lock
- MOVD abort+32(FP), R4 // arg 5 - abort
- MOVD $94, R8 // sys___thrsleep
- INVOKE_SYSCALL
- MOVW R0, ret+40(FP)
- RET
-
-TEXT runtime·thrwakeup(SB),NOSPLIT,$0
- MOVD ident+0(FP), R0 // arg 1 - ident
- MOVW n+8(FP), R1 // arg 2 - n
- MOVD $301, R8 // sys___thrwakeup
- INVOKE_SYSCALL
- MOVW R0, ret+16(FP)
- RET
-
TEXT runtime·sysctl(SB),NOSPLIT,$0
MOVD mib+0(FP), R0 // arg 1 - mib
MOVW miblen+8(FP), R1 // arg 2 - miblen