github.com/aloncn/graphics-go@v0.0.1/src/runtime/os_netbsd_arm.go (about) 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 "unsafe" 8 9 func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintptr) { 10 // Machine dependent mcontext initialisation for LWP. 11 mc.__gregs[_REG_R15] = uint32(funcPC(lwp_tramp)) 12 mc.__gregs[_REG_R13] = uint32(uintptr(stk)) 13 mc.__gregs[_REG_R0] = uint32(uintptr(unsafe.Pointer(mp))) 14 mc.__gregs[_REG_R1] = uint32(uintptr(unsafe.Pointer(gp))) 15 mc.__gregs[_REG_R2] = uint32(fn) 16 } 17 18 func checkgoarm() { 19 // TODO(minux): FP checks like in os_linux_arm.go. 20 21 // osinit not called yet, so ncpu not set: must use getncpu directly. 22 if getncpu() > 1 && goarm < 7 { 23 print("runtime: this system has multiple CPUs and must use\n") 24 print("atomic synchronization instructions. Recompile using GOARM=7.\n") 25 exit(1) 26 } 27 } 28 29 //go:nosplit 30 func cputicks() int64 { 31 // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1(). 32 // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler. 33 // TODO: need more entropy to better seed fastrand1. 34 return nanotime() 35 }