Skip to content

Commit

Permalink
Use ID_AA64ISAR0_EL1 register for WoA feature detection
Browse files Browse the repository at this point in the history
The `CP 4030` register maps to the `ID_AA64ISAR0_EL1` register on
windows.
  • Loading branch information
Wunkolo committed Sep 1, 2024
1 parent 7e1c67d commit fbb4f48
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/arm/midr.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,22 @@ struct features* get_features_info(void) {
feat->NEON = true;
feat->SVE = false;
feat->SVE2 = false;
#elif defined _WIN32
// CP 4030 maps to the ID_AA64ISAR0_EL1 register on Windows
// https://developer.arm.com/documentation/100798/0300/register-descriptions/aarch64-system-registers/id-aa64isar0-el1--aarch64-instruction-set-attribute-register-0--el1
long isar0 = 0;
if(!get_win32_core_info_64(0, "CP 4030", &isar0)) {
printWarn("Unable to retrieve ISAR0 via registry");
}
else {
feat->AES = (isar0 >> 4) & 0xF ? true : false;
feat->CRC32 = (isar0 >> 16) & 0xF ? true : false;
feat->SHA1 = (isar0 >> 8) & 0xF ? true : false;
feat->SHA2 = (isar0 >> 12) & 0xF ? true : false;
}
feat->NEON = true;
feat->SVE = false;
feat->SVE2 = false;
#endif // ifdef __linux__

if (feat->SVE || feat->SVE2) {
Expand Down

0 comments on commit fbb4f48

Please sign in to comment.