1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:17:35 +00:00

Kernel: Detect Aarch64 virtual address bit width with CPU ID registers

This commit is contained in:
konrad 2023-01-08 12:22:47 +01:00 committed by Jelle Raaijmakers
parent 401fc6afae
commit 5791072280
4 changed files with 21 additions and 2 deletions

View file

@ -1504,4 +1504,20 @@ u8 detect_physical_address_bit_width()
}
}
u8 detect_virtual_address_bit_width()
{
auto memory_model_feature_register_2 = Aarch64::ID_AA64MMFR2_EL1::read();
switch (memory_model_feature_register_2.VARange) {
case 0b0000:
return 48; // 256TB
case 0b0001:
return 52; // 4PB (only for 64KB translation granule)
case 0b0010:
return 56; // 64PB (applies for FEAT_D128)
default:
VERIFY_NOT_REACHED();
}
}
}