fix(serror): use custom argument for incrementing elr_elx
Add a custom argument to increment the elr_elx after handling SError.
In some cases, to prevent re-triggering the instruction, ELR needs
to be incremented by 4. In other cases, it may not be necessary.
This argument is passed to the handler, which then decides whether
to increment elr_elx by setting the passed argument accordingly after
handling the SError.
Change-Id: I404f3c5e24f894502a8d00c73649be0b2dd540fa
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
diff --git a/realm/realm_payload_main.c b/realm/realm_payload_main.c
index cf9cce3..131f49b 100644
--- a/realm/realm_payload_main.c
+++ b/realm/realm_payload_main.c
@@ -202,10 +202,14 @@
return false;
}
-static bool realm_serror_handler_doublefault(void)
+static bool realm_serror_handler_doublefault(bool *incr_elr_elx)
{
+ *incr_elr_elx = false;
+
if ((read_sctlr2_el1() & SCTLR2_EASE_BIT) != 0UL) {
/* The serror exception should have been routed here */
+ *incr_elr_elx = true;
+
return true;
}