Skip to content

Commit 80638ca

Browse files
committed
Split aarch64 pauth feature into paca and pacg
1 parent f4fd7ef commit 80638ca

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ features! {
3131
/// * `"flagm"` - FEAT_FLAGM
3232
/// * `"ssbs"` - FEAT_SSBS
3333
/// * `"sb"` - FEAT_SB
34-
/// * `"pauth"` - FEAT_PAuth
34+
/// * `"paca"` - FEAT_PAuth (address authentication)
35+
/// * `"pacg"` - FEAT_Pauth (generic authentication)
3536
/// * `"dpb"` - FEAT_DPB
3637
/// * `"dpb2"` - FEAT_DPB2
3738
/// * `"sve2"` - FEAT_SVE2
@@ -101,8 +102,10 @@ features! {
101102
/// FEAT_SSBS (speculative store bypass safe)
102103
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] sb: "sb";
103104
/// FEAT_SB (speculation barrier)
104-
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] pauth: "pauth";
105-
/// FEAT_PAuth (pointer authentication)
105+
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] paca: "paca";
106+
/// FEAT_PAuth (address authentication)
107+
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] pacg: "pacg";
108+
/// FEAT_PAuth (generic authentication)
106109
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] dpb: "dpb";
107110
/// FEAT_DPB (aka dcpop - data cache clean to point of persistance)
108111
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] dpb2: "dpb2";

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

+4
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ pub(crate) fn detect_features() -> cache::Initializer {
8787
);
8888
}
8989

90+
// Check for either APA or API field
91+
enable_feature(Feature::paca, bits_shift(aa64isar1, 11, 4) >= 1);
9092
enable_feature(Feature::rcpc, bits_shift(aa64isar1, 23, 20) >= 1);
93+
// Check for either GPA or GPI field
94+
enable_feature(Feature::pacg, bits_shift(aa64isar1, 31, 24) >= 1);
9195
}
9296

9397
value

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ impl AtHwcap {
230230
enable_feature(Feature::flagm, self.flagm);
231231
enable_feature(Feature::ssbs, self.ssbs);
232232
enable_feature(Feature::sb, self.sb);
233-
// FEAT_PAuth provides both paca & pacg
234-
enable_feature(Feature::pauth, self.paca && self.pacg);
233+
enable_feature(Feature::paca, self.paca);
234+
enable_feature(Feature::pacg, self.pacg);
235235
enable_feature(Feature::dpb, self.dcpop);
236236
enable_feature(Feature::dpb2, self.dcpodp);
237237
enable_feature(Feature::rand, self.rng);

crates/std_detect/tests/cpu-detection.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ fn aarch64_linux() {
5555
println!("flagm: {}", is_aarch64_feature_detected!("flagm"));
5656
println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
5757
println!("sb: {}", is_aarch64_feature_detected!("sb"));
58-
println!("pauth: {}", is_aarch64_feature_detected!("pauth"));
58+
println!("paca: {}", is_aarch64_feature_detected!("paca"));
59+
println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
5960
println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
6061
println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
6162
println!("sve2: {}", is_aarch64_feature_detected!("sve2"));

0 commit comments

Comments
 (0)