audk/MdeModulePkg
Ard Biesheuvel 765fb87c2b MdeModulePkg/FileExplorerLib: avoid packed struct for program data
Struct packing is only necessary for data structures whose in-memory
representation is covered by the PI or UEFI specs, and may deviate
from the ordinary C rules for alignment.

So in case of FileExplorerLib, this applies to the device path struct
only, and other structures used to carry program data should not be
packed, or we may end up with alignment faults on architectures such
as ARM, which don't permit load/store double or multiple instructions
to access memory locations that are not 32-bit aligned.

E.g., the following call in FileExplorerLibConstructor()

  InitializeListHead (&gFileExplorerPrivate.FsOptionMenu->Head);

which is emitted as follows for 32-bit ARM/Thumb2 by Clang-5.0

    3de0:       b510            push    {r4, lr}
    3de2:       4604            mov     r4, r0
    ...
    3de8:       e9c4 4400       strd    r4, r4, [r4]
    3dec:       bd10            pop     {r4, pc}

will perform a double-word store on the first argument, passed in
register r0, assuming that the pointer type of the argument is
enough to guarantee that the value is suitably aligned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-12-11 13:14:28 +01:00
..
Application MdeModulePkg CapsuleApp:Remove two redundant Guids 2018-09-21 11:34:42 +08:00
Bus MdeModulePkg/PciBus: Shadow option ROM after BARs are programmed 2018-12-10 10:30:13 +08:00
Core MdeModulePkg/Core: fix ineffective guard page issue 2018-11-07 23:08:27 +08:00
Include MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency 2018-11-20 13:46:57 +08:00
Library MdeModulePkg/FileExplorerLib: avoid packed struct for program data 2018-12-11 13:14:28 +01:00
Logo MdeModulePkg: Removing ipf which is no longer supported from edk2. 2018-09-06 15:25:16 +08:00
Universal MdeModulePkg PCD: Add DynamicEx PcdVpdBaseAddress64 for non SPI platform 2018-11-27 11:29:21 +08:00
MdeModulePkg.dec MdeModulePkg PCD: Add DynamicEx PcdVpdBaseAddress64 for non SPI platform 2018-11-27 11:29:21 +08:00
MdeModulePkg.dsc MdeModulePkg BrotliCustomDecompressLib: Don't build it for EBC arch 2018-10-15 15:55:55 +08:00
MdeModulePkg.uni MdeModulePkg: Correct PCD name in MdeModulePkg.uni 2018-12-03 08:29:26 +08:00
MdeModulePkgExtra.uni MdeModulePkg: Clean up source files 2018-06-28 11:19:45 +08:00