1
2
3
4
5 package cpu
6
7
8
9
10 const CacheLinePadSize = 128
11
12 func doinit() {
13 options = []option{
14 {Name: "aes", Feature: &ARM64.HasAES},
15 {Name: "pmull", Feature: &ARM64.HasPMULL},
16 {Name: "sha1", Feature: &ARM64.HasSHA1},
17 {Name: "sha2", Feature: &ARM64.HasSHA2},
18 {Name: "sha512", Feature: &ARM64.HasSHA512},
19 {Name: "crc32", Feature: &ARM64.HasCRC32},
20 {Name: "atomics", Feature: &ARM64.HasATOMICS},
21 {Name: "cpuid", Feature: &ARM64.HasCPUID},
22 {Name: "isNeoverse", Feature: &ARM64.IsNeoverse},
23 }
24
25
26 osInit()
27 }
28
29 func getisar0() uint64
30
31 func getMIDR() uint64
32
33 func extractBits(data uint64, start, end uint) uint {
34 return (uint)(data>>start) & ((1 << (end - start + 1)) - 1)
35 }
36
37 func parseARM64SystemRegisters(isar0 uint64) {
38
39 switch extractBits(isar0, 4, 7) {
40 case 1:
41 ARM64.HasAES = true
42 case 2:
43 ARM64.HasAES = true
44 ARM64.HasPMULL = true
45 }
46
47 switch extractBits(isar0, 8, 11) {
48 case 1:
49 ARM64.HasSHA1 = true
50 }
51
52 switch extractBits(isar0, 12, 15) {
53 case 1:
54 ARM64.HasSHA2 = true
55 case 2:
56 ARM64.HasSHA2 = true
57 ARM64.HasSHA512 = true
58 }
59
60 switch extractBits(isar0, 16, 19) {
61 case 1:
62 ARM64.HasCRC32 = true
63 }
64
65 switch extractBits(isar0, 20, 23) {
66 case 2:
67 ARM64.HasATOMICS = true
68 }
69 }
70
View as plain text