From fc589d727965af37186e40eee33c8a16c095e015 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Wed, 13 Nov 2019 12:43:12 -0800 Subject: [PATCH] x86: implement 64-bit exception recovery logic The esf has a different set of members on 64-bit. Signed-off-by: Andrew Boie --- arch/x86/core/fatal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/core/fatal.c b/arch/x86/core/fatal.c index 57ad957c6b5..21156365f35 100644 --- a/arch/x86/core/fatal.c +++ b/arch/x86/core/fatal.c @@ -378,11 +378,19 @@ void z_x86_page_fault_handler(z_arch_esf_t *esf) int i; for (i = 0; i < ARRAY_SIZE(exceptions); i++) { +#ifdef CONFIG_X86_64 + if ((void *)esf->rip >= exceptions[i].start && + (void *)esf->rip < exceptions[i].end) { + esf->rip = (u64_t)(exceptions[i].fixup); + return; + } +#else if ((void *)esf->eip >= exceptions[i].start && (void *)esf->eip < exceptions[i].end) { esf->eip = (unsigned int)(exceptions[i].fixup); return; } +#endif /* CONFIG_X86_64 */ } #endif #ifdef CONFIG_EXCEPTION_DEBUG