diff --git a/bl31/aarch64/ea_delegate.S b/bl31/aarch64/ea_delegate.S index dce1f5a..d18f9e5 100644 --- a/bl31/aarch64/ea_delegate.S +++ b/bl31/aarch64/ea_delegate.S @@ -6,6 +6,7 @@ #include +#include #include #include @@ -143,9 +144,24 @@ mov sp, x5 mov x29, x30 +#if ENABLE_ASSERTIONS + /* Stash the stack pointer */ + mov x28, sp +#endif bl plat_ea_handler mov x30, x29 +#if ENABLE_ASSERTIONS + /* + * Error handling flows might involve long jumps; so upon returning from + * the platform error handler, validate that the we've completely + * unwound the stack. + */ + mov x27, sp + cmp x28, x27 + ASM_ASSERT(eq) +#endif + /* Make SP point to context */ msr spsel, #1