audk/ArmPlatformPkg/PrePi
Ard Biesheuvel 4aae7419ee 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>
2016-10-24 15:57:25 +01:00
..
AArch64 ArmPlatformPkg/PrePi: avoid global variable write to mSystemMemoryEnd 2016-10-24 15:57:25 +01:00
Arm ArmPlatformPkg/PrePi: avoid global variable write to mSystemMemoryEnd 2016-10-24 15:57:25 +01:00
LzmaDecompress.h ARM Packages: Removed trailing spaces 2014-08-19 13:29:52 +00:00
MainMPCore.c ArmPkg ArmPlatformPkg ArmVirtPkg: ARM GICv2/v3 Base Address width fix-up 2016-09-08 09:16:01 +01:00
MainUniCore.c ArmPlatformPkg/PrePi: allow unicore version to be used on MP hardware 2016-04-29 18:12:52 +02:00
PeiMPCore.inf ArmPlatformPkg: Rectify file modes 2016-02-02 11:42:31 +00:00
PeiUniCore.inf ArmPlatformPkg: Rectify file modes 2016-02-02 11:42:31 +00:00
PrePi.c ArmPlatformPkg/PrePi: avoid global variable write to mSystemMemoryEnd 2016-10-24 15:57:25 +01:00
PrePi.h ArmPlatformPkg/PrePi: remove global variable allocation from lowlevel init 2015-11-27 17:07:06 +00:00