B runtime·atomicstore(SB)
// armPublicationBarrier is a native store/store barrier for ARMv7+.
+// On earlier ARM revisions, armPublicationBarrier is a no-op.
+// This will not work on SMP ARMv6 machines, if any are in use.
// To implement publiationBarrier in sys_$GOOS_arm.s using the native
// instructions, use:
//
// B runtime·armPublicationBarrier(SB)
//
TEXT runtime·armPublicationBarrier(SB),NOSPLIT,$-4-0
+ MOVB runtime·goarm(SB), R11
+ CMP $7, R11
+ BLT 2(PC)
WORD $0xf57ff05e // DMB ST
RET
// bsdthread_register delayed until end of goenvs so that we
// can look at the environment first.
+ ncpu = getncpu()
+}
+
+func getncpu() int32 {
// Use sysctl to fetch hw.ncpu.
mib := [2]uint32{6, 3}
out := uint32(0)
nout := unsafe.Sizeof(out)
ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
- if ret >= 0 {
- ncpu = int32(out)
+ if ret >= 0 && int32(out) > 0 {
+ return int32(out)
}
+ return 1
}
var urandom_dev = []byte("/dev/urandom\x00")
package runtime
func checkgoarm() {
- return // TODO(minux)
+ // TODO(minux): FP checks like in os_linux_arm.go.
+
+ // osinit not called yet, so ncpu not set: must use getncpu directly.
+ if getncpu() > 1 && goarm < 7 {
+ print("runtime: this system has multiple CPUs and must use\n")
+ print("atomic synchronization instructions. Recompile using GOARM=7.\n")
+ exit(1)
+ }
}
//go:nosplit
package runtime
func checkgoarm() {
- // TODO(minux)
+ // TODO(minux): FP checks like in os_linux_arm.go.
+
+ // osinit not called yet, so ncpu not set: must use getncpu directly.
+ if getncpu() > 1 && goarm < 7 {
+ print("runtime: this system has multiple CPUs and must use\n")
+ print("atomic synchronization instructions. Recompile using GOARM=7.\n")
+ exit(1)
+ }
}
//go:nosplit
var randomNumber uint32
var armArch uint8 = 6 // we default to ARMv6
var hwcap uint32 // set by setup_auxv
-var goarm uint8 // set by 5l
func checkgoarm() {
if goarm > 5 && hwcap&_HWCAP_VFP == 0 {
package runtime
func checkgoarm() {
- return // NaCl/ARM only supports ARMv7
+ // TODO(minux): FP checks like in os_linux_arm.go.
+
+ // NaCl/ARM only supports ARMv7
+ if goarm != 7 {
+ print("runtime: NaCl requires ARMv7. Recompile using GOARM=7.\n")
+ exit(1)
+ }
}
//go:nosplit
}
func checkgoarm() {
- // TODO(minux)
+ // TODO(minux): FP checks like in os_linux_arm.go.
+
+ // osinit not called yet, so ncpu not set: must use getncpu directly.
+ if getncpu() > 1 && goarm < 7 {
+ print("runtime: this system has multiple CPUs and must use\n")
+ print("atomic synchronization instructions. Recompile using GOARM=7.\n")
+ exit(1)
+ }
}
//go:nosplit
package runtime
func checkgoarm() {
- // TODO(minux)
+ // TODO(minux): FP checks like in os_linux_arm.go.
+
+ // osinit not called yet, so ncpu not set: must use getncpu directly.
+ if getncpu() > 1 && goarm < 7 {
+ print("runtime: this system has multiple CPUs and must use\n")
+ print("atomic synchronization instructions. Recompile using GOARM=7.\n")
+ exit(1)
+ }
}
//go:nosplit
cpuid_ecx uint32
cpuid_edx uint32
lfenceBeforeRdtsc bool
+
+ goarm uint8 // set by cmd/link on arm systems
)
// Set by the linker so the runtime can determine the buildmode.