diff --git a/arch/arm/core/aarch64/fatal.c b/arch/arm/core/aarch64/fatal.c index ca47d41b86..64fed940f2 100644 --- a/arch/arm/core/aarch64/fatal.c +++ b/arch/arm/core/aarch64/fatal.c @@ -169,7 +169,18 @@ static void esf_dump(const z_arch_esf_t *esf) esf->basic.regs[0], esf->basic.regs[1]); } -void z_arm64_fatal_error(unsigned int reason, const z_arch_esf_t *esf) +static bool is_recoverable(z_arch_esf_t *esf, uint64_t esr, uint64_t far, + uint64_t elr) +{ + if (!esf) + return false; + + /* Empty */ + + return false; +} + +void z_arm64_fatal_error(unsigned int reason, z_arch_esf_t *esf) { uint64_t esr = 0; uint64_t elr = 0; @@ -201,6 +212,9 @@ void z_arm64_fatal_error(unsigned int reason, const z_arch_esf_t *esf) if (dump_far) LOG_ERR("FAR_ELn: 0x%016llx", far); + + if (is_recoverable(esf, esr, far, elr)) + return; } } diff --git a/arch/arm/core/aarch64/irq_manage.c b/arch/arm/core/aarch64/irq_manage.c index a2cdd27eaf..32136c1972 100644 --- a/arch/arm/core/aarch64/irq_manage.c +++ b/arch/arm/core/aarch64/irq_manage.c @@ -18,7 +18,7 @@ #include #include -void z_arm64_fatal_error(unsigned int reason, const z_arch_esf_t *esf); +void z_arm64_fatal_error(unsigned int reason, z_arch_esf_t *esf); #if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER) /* diff --git a/arch/arm/core/aarch64/switch.S b/arch/arm/core/aarch64/switch.S index 244df0a396..ea933e5ad2 100644 --- a/arch/arm/core/aarch64/switch.S +++ b/arch/arm/core/aarch64/switch.S @@ -144,7 +144,10 @@ exit: inv: mov x0, #0 /* K_ERR_CPU_EXCEPTION */ mov x1, sp - b z_arm64_fatal_error + bl z_arm64_fatal_error + + /* Return here only in case of recoverable error */ + z_arm64_exit_exc x0, x1 GTEXT(z_arm64_call_svc) SECTION_FUNC(TEXT, z_arm64_call_svc) diff --git a/arch/arm/core/aarch64/vector_table.S b/arch/arm/core/aarch64/vector_table.S index ee019d8a9e..558b7e37ac 100644 --- a/arch/arm/core/aarch64/vector_table.S +++ b/arch/arm/core/aarch64/vector_table.S @@ -136,4 +136,7 @@ SECTION_FUNC(TEXT, z_arm64_serror) mov x1, sp mov x0, #0 /* K_ERR_CPU_EXCEPTION */ - b z_arm64_fatal_error + bl z_arm64_fatal_error + + /* Return here only in case of recoverable error */ + z_arm64_exit_exc x0, x1 diff --git a/arch/arm/include/aarch64/kernel_arch_func.h b/arch/arm/include/aarch64/kernel_arch_func.h index 0ddf3249e2..430a0d8a41 100644 --- a/arch/arm/include/aarch64/kernel_arch_func.h +++ b/arch/arm/include/aarch64/kernel_arch_func.h @@ -39,7 +39,7 @@ static inline void arch_switch(void *switch_to, void **switched_from) return; } -extern void z_arm64_fatal_error(const z_arch_esf_t *esf, unsigned int reason); +extern void z_arm64_fatal_error(z_arch_esf_t *esf, unsigned int reason); #endif /* _ASMLANGUAGE */