coreboot/payloads/libpayload/arch
Julius Werner 84e000b88e libpayload: arm64: Fix alignment for exception_state
In the arm64 exception handler in libpayload, we use the banked
exception stack pointer (SP_EL2, as opposed to the normal SP_EL0) not as
a normal stack pointer, but simply as a pointer to the exception_state
struct. This makes it easy to dump all registers into that struct on
context switch. We then immediately switch back to SP_EL0.

Yet, even though it is not really a stack for us, the aarch64
architecture still requires that SP_EL2 is 16 byte aligned at function
boundaries. If the exception_state struct is not thus aligned,
exceptions are broken. (I don't know why nobody ever hit this before,
but I hit it now while trying to pull in zstd code. I guess we just
don't have unaligned BSS entries that often and simply got lucky for a
while. 3 hours wasted on debugging. :( )

Change-Id: Id19184656fb9da68fe4bfdbc240c0c25b9d24cd6
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89926
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
2025-11-10 02:36:39 +00:00
..
arm libpayload: Use Kconfig for architecture memcpy, not weak symbols 2025-05-22 19:27:24 +00:00
arm64 libpayload: arm64: Fix alignment for exception_state 2025-11-10 02:36:39 +00:00
mock libpayload/arch/mock: Select ARCH_HAS_NDELAY for ARCH_MOCK 2025-05-28 00:15:29 +00:00
x86 libpayload: Use Kconfig instead of weak symbol for arch_ndelay() 2025-05-22 19:27:30 +00:00