15
15
//!
16
16
//! - [Zircon implementation](https://fuchsia.googlesource.com/zircon/+/master/kernel/arch/arm64/feature.cpp)
17
17
//! - [Linux documentation](https://www.kernel.org/doc/Documentation/arm64/cpu-feature-registers.txt)
18
+ //! - [ARM documentation](https://developer.arm.com/documentation/ddi0601/2022-12/AArch64-Registers?lang=en)
18
19
19
20
use crate :: detect:: { cache, Feature } ;
20
21
use core:: arch:: asm;
@@ -43,6 +44,16 @@ pub(crate) fn detect_features() -> cache::Initializer {
43
44
) ;
44
45
}
45
46
47
+ // ID_AA64MMFR2_EL1 - AArch64 Memory Model Feature Register 2
48
+ let aa64mmfr2: u64 ;
49
+ unsafe {
50
+ asm ! (
51
+ "mrs {}, ID_AA64MMFR2_EL1" ,
52
+ out( reg) aa64mmfr2,
53
+ options( pure, nomem, preserves_flags, nostack)
54
+ ) ;
55
+ }
56
+
46
57
// ID_AA64PFR0_EL1 - Processor Feature Register 0
47
58
let aa64pfr0: u64 ;
48
59
unsafe {
@@ -53,12 +64,13 @@ pub(crate) fn detect_features() -> cache::Initializer {
53
64
) ;
54
65
}
55
66
56
- parse_system_registers ( aa64isar0, aa64isar1, Some ( aa64pfr0) )
67
+ parse_system_registers ( aa64isar0, aa64isar1, aa64mmfr2 , Some ( aa64pfr0) )
57
68
}
58
69
59
70
pub ( crate ) fn parse_system_registers (
60
71
aa64isar0 : u64 ,
61
72
aa64isar1 : u64 ,
73
+ aa64mmfr2 : u64 ,
62
74
aa64pfr0 : Option < u64 > ,
63
75
) -> cache:: Initializer {
64
76
let mut value = cache:: Initializer :: default ( ) ;
@@ -72,7 +84,7 @@ pub(crate) fn parse_system_registers(
72
84
// ID_AA64ISAR0_EL1 - Instruction Set Attribute Register 0
73
85
enable_feature ( Feature :: pmull, bits_shift ( aa64isar0, 7 , 4 ) >= 2 ) ;
74
86
enable_feature ( Feature :: tme, bits_shift ( aa64isar0, 27 , 24 ) == 1 ) ;
75
- enable_feature ( Feature :: lse, bits_shift ( aa64isar0, 23 , 20 ) >= 1 ) ;
87
+ enable_feature ( Feature :: lse, bits_shift ( aa64isar0, 23 , 20 ) >= 2 ) ;
76
88
enable_feature ( Feature :: crc, bits_shift ( aa64isar0, 19 , 16 ) >= 1 ) ;
77
89
78
90
// ID_AA64PFR0_EL1 - Processor Feature Register 0
@@ -99,13 +111,16 @@ pub(crate) fn parse_system_registers(
99
111
enable_feature ( Feature :: sve, asimd && bits_shift ( aa64pfr0, 35 , 32 ) >= 1 ) ;
100
112
}
101
113
102
- // ID_AA64PFR0_EL1 - Processor Feature Register 0
114
+ // ID_AA64ISAR1_EL1 - Instruction Set Attribute Register 1
103
115
// Check for either APA or API field
104
116
enable_feature ( Feature :: paca, bits_shift ( aa64isar1, 11 , 4 ) >= 1 ) ;
105
117
enable_feature ( Feature :: rcpc, bits_shift ( aa64isar1, 23 , 20 ) >= 1 ) ;
106
118
// Check for either GPA or GPI field
107
119
enable_feature ( Feature :: pacg, bits_shift ( aa64isar1, 31 , 24 ) >= 1 ) ;
108
120
121
+ // ID_AA64MMFR2_EL1 - AArch64 Memory Model Feature Register 2
122
+ enable_feature ( Feature :: lse2, bits_shift ( aa64mmfr2, 35 , 32 ) >= 1 ) ;
123
+
109
124
value
110
125
}
111
126
0 commit comments