]> git.proxmox.com Git - mirror_edk2.git/commit
ArmPlatformPkg/PrePi: avoid global variable write to mSystemMemoryEnd
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 24 Oct 2016 08:48:32 +0000 (09:48 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 24 Oct 2016 14:57:25 +0000 (15:57 +0100)
commit4aae7419eeba36dfca48ecb59677a1ab27cffbb0
tree4745780d143e32b50e4364e5ba8d225b9cbff108
parent5b005a6b322feea8be7303ad50a09cecfecdbaba
ArmPlatformPkg/PrePi: avoid global variable write to mSystemMemoryEnd

The global variable mSystemMemoryEnd is initialized by PrePi only if
it has not been initialized by ArmPlatformPeiBootAction(). This allows
platforms executing under, e.g., ARM Trusted Firmware to dynamically
reserve a window at the top of memory that will be used by the secure
firmware.

However, PrePi is a SEC module, and writing to a global variable
violates the SEC constraints, since SEC and PEI may execute from NOR
flash.

So instead, initialize mSystemMemoryEnd statically. This will ensure
it holds the correct value for all implementations where the value
is not overridden, but still allows it to be overridden during the
call to ArmPlatformPeiBootAction().

Note that this patch also fixes a latent bug on 32-bit platforms where
a value of mSystemMemoryEnd exceeding 4 GB would be truncated to 32-bits
rather than limited to (4 GB - 1)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S
ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
ArmPlatformPkg/PrePi/PrePi.c