]> git.proxmox.com Git - mirror_edk2.git/commit - ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
ArmPlatformPkg/NorFlashDxe: use strictly aligned CopyMem()
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 7 Sep 2016 10:32:42 +0000 (11:32 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 9 Sep 2016 12:48:49 +0000 (13:48 +0100)
commitbdb10148fcf58f03933e9c25c19e618b972f8ccb
tree636a2f59beb724286a85cf705fe57198e7ec4121
parent35071e15748fa54809e485935b631dbe58c1f078
ArmPlatformPkg/NorFlashDxe: use strictly aligned CopyMem()

The UEFI spec stipulates that unaligned accesses should be enabled
on CPUs that support them, which means all of them, given that we
no longer support pre-v7 ARM cores, and the AARCH64 bindings mandate
support for unaligned accesses unconditionally.

This means that one should not assume that CopyMem () is safe to call
on regions that may be mapped using device attributes, which is the
case for the NOR flash. Since we have no control over the mappings when
running under the OS, and given that write accesses require device
mappings, we should not call CopyMem () in the read path either, but
use our own implementation that is guaranteed to take alignment into
account.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c