| 1 |
// Copyright 2020 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build openbsd && !mips64 |
| 6 |
|
| 7 |
package runtime |
| 8 |
|
| 9 |
import ( |
| 10 |
"internal/abi" |
| 11 |
"unsafe" |
| 12 |
) |
| 13 |
|
| 14 |
//go:nosplit |
| 15 |
//go:cgo_unsafe_args |
| 16 |
func thrsleep(ident uintptr, clock_id int32, tsp *timespec, lock uintptr, abort *uint32) int32 { |
| 17 |
ret := libcCall(unsafe.Pointer(abi.FuncPCABI0(thrsleep_trampoline)), unsafe.Pointer(&ident)) |
| 18 |
KeepAlive(tsp) |
| 19 |
KeepAlive(abort) |
| 20 |
return ret |
| 21 |
} |
| 22 |
func thrsleep_trampoline() |
| 23 |
|
| 24 |
//go:nosplit |
| 25 |
//go:cgo_unsafe_args |
| 26 |
func thrwakeup(ident uintptr, n int32) int32 { |
| 27 |
return libcCall(unsafe.Pointer(abi.FuncPCABI0(thrwakeup_trampoline)), unsafe.Pointer(&ident)) |
| 28 |
} |
| 29 |
func thrwakeup_trampoline() |
| 30 |
|
| 31 |
//go:nosplit |
| 32 |
func osyield() { |
| 33 |
libcCall(unsafe.Pointer(abi.FuncPCABI0(sched_yield_trampoline)), unsafe.Pointer(nil)) |
| 34 |
} |
| 35 |
func sched_yield_trampoline() |
| 36 |
|
| 37 |
//go:nosplit |
| 38 |
func osyield_no_g() { |
| 39 |
asmcgocall_no_g(unsafe.Pointer(abi.FuncPCABI0(sched_yield_trampoline)), unsafe.Pointer(nil)) |
| 40 |
} |
| 41 |
|
| 42 |
//go:cgo_import_dynamic libc_thrsleep __thrsleep "libc.so" |
| 43 |
//go:cgo_import_dynamic libc_thrwakeup __thrwakeup "libc.so" |
| 44 |
//go:cgo_import_dynamic libc_sched_yield sched_yield "libc.so" |
| 45 |
|
| 46 |
//go:cgo_import_dynamic _ _ "libc.so" |