Skip to content

Commit 4f2e3cb

Browse files
mrkajetanpAmanieu
authored andcommitted
std_detect: Add pauth-lr aarch64 target feature
Add feature detection for aarch64 FEAT_PAuth_LR. There is currently no Linux cpuinfo support so the OS-specific lines are commented out.
1 parent 0669fa8 commit 4f2e3cb

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

crates/std_detect/src/detect/arch/aarch64.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ features! {
5151
/// * `"mte"` - FEAT_MTE & FEAT_MTE2
5252
/// * `"paca"` - FEAT_PAuth (address authentication)
5353
/// * `"pacg"` - FEAT_Pauth (generic authentication)
54+
/// * `"pauth-lr"` - FEAT_PAuth_LR
5455
/// * `"pmull"` - FEAT_PMULL
5556
/// * `"rand"` - FEAT_RNG
5657
/// * `"rcpc"` - FEAT_LRCPC
@@ -184,6 +185,8 @@ features! {
184185
/// FEAT_PAuth (address authentication)
185186
@FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] pacg: "pacg";
186187
/// FEAT_PAuth (generic authentication)
188+
@FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] pauth_lr: "pauth-lr";
189+
/// FEAT_PAuth_LR
187190
@FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rand: "rand";
188191
/// FEAT_RNG (Random Number Generator)
189192
@FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rcpc: "rcpc";

crates/std_detect/src/detect/os/linux/aarch64.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ struct AtHwcap {
140140
smesf8fma: bool,
141141
smesf8dp4: bool,
142142
smesf8dp2: bool,
143+
// pauthlr: bool,
143144
}
144145

145146
impl From<auxvec::AuxVec> for AtHwcap {
@@ -243,6 +244,7 @@ impl From<auxvec::AuxVec> for AtHwcap {
243244
smesf8fma: bit::test(auxv.hwcap2, 60),
244245
smesf8dp4: bit::test(auxv.hwcap2, 61),
245246
smesf8dp2: bit::test(auxv.hwcap2, 62),
247+
// pauthlr: bit::test(auxv.hwcap2, ??),
246248
}
247249
}
248250
}
@@ -353,6 +355,7 @@ impl From<super::cpuinfo::CpuInfo> for AtHwcap {
353355
smesf8fma: f.has("smesf8fma"),
354356
smesf8dp4: f.has("smesf8dp4"),
355357
smesf8dp2: f.has("smesf8dp2"),
358+
// pauthlr: f.has("pauthlr"),
356359
}
357360
}
358361
}
@@ -413,6 +416,7 @@ impl AtHwcap {
413416
enable_feature(Feature::sb, self.sb);
414417
enable_feature(Feature::paca, self.paca);
415418
enable_feature(Feature::pacg, self.pacg);
419+
// enable_feature(Feature::pauth_lr, self.pauthlr);
416420
enable_feature(Feature::dpb, self.dcpop);
417421
enable_feature(Feature::dpb2, self.dcpodp);
418422
enable_feature(Feature::rand, self.rng);

crates/std_detect/tests/cpu-detection.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ fn aarch64_linux() {
8383
println!("sb: {}", is_aarch64_feature_detected!("sb"));
8484
println!("paca: {}", is_aarch64_feature_detected!("paca"));
8585
println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
86+
// println!("pauth-lr: {}", is_aarch64_feature_detected!("pauth-lr"));
8687
println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
8788
println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
8889
println!("sve-b16b16: {}", is_aarch64_feature_detected!("sve-b16b16"));

0 commit comments

Comments
 (0)