From 19a279ce451569656eeadad7a6b3ebd57bb8ecf6 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 1 Dec 2020 13:56:01 -0800 Subject: [PATCH] kern: fix race-crash on interrupt controller save, improve fatal output --- .../source/arch/arm/kern_generic_interrupt_controller.inc | 3 --- .../source/board/nintendo/nx/kern_k_system_control.cpp | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/libmesosphere/source/arch/arm/kern_generic_interrupt_controller.inc b/libraries/libmesosphere/source/arch/arm/kern_generic_interrupt_controller.inc index 12fc57c2f..07d2e22b1 100644 --- a/libraries/libmesosphere/source/arch/arm/kern_generic_interrupt_controller.inc +++ b/libraries/libmesosphere/source/arch/arm/kern_generic_interrupt_controller.inc @@ -79,9 +79,6 @@ namespace ams::kern::arch::arm { /* Setup all interrupt lines. */ SetupInterruptLines(core_id); - - this->gicd = nullptr; - this->gicc = nullptr; } void KInterruptController::SaveCoreLocal(LocalState *state) const { diff --git a/libraries/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp b/libraries/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp index c70c59e64..5024082e7 100644 --- a/libraries/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp +++ b/libraries/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp @@ -570,11 +570,16 @@ namespace ams::kern::board::nintendo::nx { f_ctx->afsr0 = 0; f_ctx->afsr1 = GetVersionIdentifier(); + /* Set efsr/far. */ + f_ctx->far = cpu::GetFarEl1(); + f_ctx->esr = cpu::GetEsrEl1(); + /* Copy registers. */ for (size_t i = 0; i < util::size(e_ctx->x); ++i) { f_ctx->gprs[i] = e_ctx->x[i]; } f_ctx->sp = e_ctx->sp; + f_ctx->pc = cpu::GetElrEl1(); /* Dump stack trace. */ {