libpayload: arm64: Make exception handling closer to arm32

Hardware / Coreboot - Julius Werner [] - 12 October 2018 20:17 UTC

This patch reworks the arm64 exception handling to be more similar to how it works on arm32. This includes a bunch of features like actually saving and restoring more exception state in the exception_state structure and supporting the same sort of partial reentrancy that is useful for GDB. Since there's no instruction to directly load into or store out of SP on arm64, we can't do quite the same thing where we use that to read an exception_state_ptr variable right after exception entry when no other register is available. But we can do something very similar by (ab-)using the "high" stack pointer (SP_EL2) as a pointer to the exception_state struct and providing a function to change it.

Change-Id: Ia16a1124be1824392a309ae1f4cb031547d184c1

5c0e72ff99 libpayload: arm64: Make exception handling closer to arm32
payloads/libpayload/arch/arm64/exception.c | 15 +-
payloads/libpayload/arch/arm64/exception_asm.S | 152 +++++++++++++--------
payloads/libpayload/arch/arm64/head.S | 12 --
payloads/libpayload/arch/arm64/libpayload.ldscript | 9 --
payloads/libpayload/include/arm64/arch/exception.h | 90 +++++++++++-
5 files changed, 191 insertions(+), 87 deletions(-)


  • Share