]> git.proxmox.com Git - mirror_edk2.git/commit - ArmPkg/Include/Chipset/AArch64Mmu.h
ArmPkg/ArmMmuLib: avoid type promotion in TCR_EL1 assignment
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 13 Jul 2016 07:06:49 +0000 (09:06 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 13 Jul 2016 10:38:48 +0000 (12:38 +0200)
commit31441f298365dd182a7a672f1b40fbdb6115c12f
tree10d0ab92a932c5d507c034b3a034cad2a2405540
parent30dc4a49b6e303d7a53ff27a8334269cfe3662e9
ArmPkg/ArmMmuLib: avoid type promotion in TCR_EL1 assignment

Commit fafb7e9c110e ("ArmPkg: correct TTBR1_EL1 settings in TCR_EL1")
introduced a symbolic constant TCR_TG1_4KB which resolves to (2 << 30),
and ORs it into the value to be written into TCR_EL1 (if executing at
EL1). Since the constant is implicitly typed as signed int, and has the
sign bit set, the promotion that occurs when casting to UINT64 results
in a TCR value that has bits [63:32] all set, which includes mostly
RES0 bits but also the TBIn, AS and IPS fields.

So explicitly redefine all TCR related constants as 'unsigned long'
types, using the UL suffix. To avoid confusion in the future, the
inappropriately named VTCR_EL23_xxx constants have the leading V
removed, and the actual VTCR_EL2 related constants are dropped, given
that we never configure stage 2 translation in UEFI.

Reported-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
ArmPkg/Include/Chipset/AArch64Mmu.h