Hi,
I'm getting Alignment Fault when running UEFI image on Juno R0 board which is caused by VariableRuntimeDxe driver's Reclaim() function calling
// // Copy variable store header. // CopyMem (ValidBuffer, VariableStoreHeader, sizeof (VARIABLE_STORE_HEADER));
in edk2\MdeModulePkg\Universal\Variable\RuntimeDxe\Variable.c.
The code above copies 28 bytes of data from NOR flash memory region @0xBFC0048 using __memcpy() from
edk2\MdePkg\Library\BaseMemoryLibOptDxe\AArch64\CopyMem.S using unaligned memory accesses, causing Alignment fault for flash region which is mapped as device memory.
The fix involves switching to generic baseMemoryLib and for ArmJuno.dsc is listed below:
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { <LibraryClasses> NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf }
and is similar to the following commits for Hisilicon/D02/D03/D05:
Hisilicon/D02: flash related drivers switch to use generic BaseMemoryLib:
https://git.linaro.org/uefi/OpenPlatformPkg.git/commit/Platforms/Hisilicon/D...
Hisilicon/D03: flash related drivers switch to use generic BaseMemoryLib:
https://git.linaro.org/uefi/OpenPlatformPkg.git/commit/Platforms/Hisilicon/D...
Hisilicon/D05: flash related drivers switch to use generic BaseMemoryLib:
https://git.linaro.org/uefi/OpenPlatformPkg.git/commit/Platforms/Hisilicon/D...
Alexei.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.