...
Source file src/runtime/os_linux_arm.go
1
2
3
4
5 package runtime
6
7 import "internal/cpu"
8
9 const (
10 _HWCAP_VFP = 1 << 6
11 _HWCAP_VFPv3 = 1 << 13
12 )
13
14 var randomNumber uint32
15
16 func checkgoarm() {
17
18
19
20 if GOOS == "android" {
21 return
22 }
23 if goarm > 5 && cpu.HWCap&_HWCAP_VFP == 0 {
24 print("runtime: this CPU has no floating point hardware, so it cannot run\n")
25 print("this GOARM=", goarm, " binary. Recompile using GOARM=5.\n")
26 exit(1)
27 }
28 if goarm > 6 && cpu.HWCap&_HWCAP_VFPv3 == 0 {
29 print("runtime: this CPU has no VFPv3 floating point hardware, so it cannot run\n")
30 print("this GOARM=", goarm, " binary. Recompile using GOARM=5 or GOARM=6.\n")
31 exit(1)
32 }
33 }
34
35 func archauxv(tag, val uintptr) {
36 switch tag {
37 case _AT_RANDOM:
38
39
40
41 randomNumber = uint32(startupRandomData[4]) | uint32(startupRandomData[5])<<8 |
42 uint32(startupRandomData[6])<<16 | uint32(startupRandomData[7])<<24
43
44 case _AT_HWCAP:
45 cpu.HWCap = uint(val)
46 case _AT_HWCAP2:
47 cpu.HWCap2 = uint(val)
48 }
49 }
50
51
52 func cputicks() int64 {
53
54
55
56 return nanotime() + int64(randomNumber)
57 }
58
View as plain text