Debian Codegraph @

src/runtime/os_netbsd_arm.go

raw
1 // Copyright 2013 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 package runtime
6
7 import (
8 "internal/abi"
9 "unsafe"
10 )
11
12 func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintptr) {
13 // Machine dependent mcontext initialisation for LWP.
14 mc.__gregs[_REG_R15] = uint32(abi.FuncPCABI0(lwp_tramp))
15 mc.__gregs[_REG_R13] = uint32(uintptr(stk))
16 mc.__gregs[_REG_R0] = uint32(uintptr(unsafe.Pointer(mp)))
17 mc.__gregs[_REG_R1] = uint32(uintptr(unsafe.Pointer(gp)))
18 mc.__gregs[_REG_R2] = uint32(fn)
19 }
20
21 func checkgoarm() {
22 // TODO(minux): FP checks like in os_linux_arm.go.
23
24 // osinit not called yet, so numCPUStartup not set: must use
25 // getCPUCount directly.
26 if getCPUCount() > 1 && goarm < 7 {
27 print("runtime: this system has multiple CPUs and must use\n")
28 print("atomic synchronization instructions. Recompile using GOARM=7.\n")
29 exit(1)
30 }
31 }
32
33 //go:nosplit
34 func cputicks() int64 {
35 // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
36 return nanotime()
37 }