• Sandrine Bailleux's avatar
    Fill exception vectors with zero bytes · 79627dc3
    Sandrine Bailleux authored
    The documentation of the GNU assembler specifies the following about
    the .align assembler directive:
     "the padding bytes are normally zero. However, on some systems, if
     the section is marked as containing code and the fill value is
     omitted, the space is filled with no-op instructions."
    (see https://sourceware.org/binutils/docs/as/Align.html)
    
    When building Trusted Firmware, the AArch64 GNU assembler uses a
    mix of zero bytes and no-op instructions as the padding bytes to
    align exception vectors.
    
    This patch mandates to use zero bytes to be stored in the padding
    bytes in the exception vectors. In the AArch64 instruction set, no
    valid instruction encodes as zero so this effectively inserts
    illegal instructions. Should this code end up being executed for
    any reason, it would crash immediately. This gives us an extra
    protection against misbehaving code at no extra cost.
    
    Change-Id: I4f2abb39d0320ca0f9d467fc5af0cb92ae297351
    79627dc3
asm_macros.S 6.54 KB