From: Joel Sing Date: Tue, 26 Jan 2021 06:52:19 +0000 (+1100) Subject: runtime: convert openbsd/arm64 locking to libc X-Git-Tag: go1.16rc1~7 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6c8fbfbdcfa48ca29926097b20767fe83409b3ed;p=gostls13.git 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 Reviewed-by: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot --- 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