ArmPkg/ArmLib: add support for reading the max physical address space size
Add a helper function that returns the maximum physical address space size as supported by the current CPU. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
@ -169,4 +169,12 @@
|
||||
isb
|
||||
bx lr
|
||||
|
||||
RVCT_ASM_EXPORT ArmGetPhysicalAddressBits
|
||||
mrc p15, 0, r0, c0, c1, 4 ; MMFR0
|
||||
and r0, r0, #0xf ; VMSA [3:0]
|
||||
cmp r0, #5 ; >= 5 implies LPAE support
|
||||
movlt r0, #32 ; 32 bits if no LPAE
|
||||
movge r0, #40 ; 40 bits if LPAE
|
||||
bx lr
|
||||
|
||||
END
|
||||
|
Reference in New Issue
Block a user