From ea830bb5ab24d697e9460972f84b54fb7ba10dfd Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Wed, 26 Feb 2020 01:54:12 +0000 Subject: [PATCH] thermosphere: propagate changes --- .../src/hvisor_exception_dispatcher.cpp | 24 ++++++++++++------- thermosphere/src/traps/hvisor_traps_hvc.cpp | 4 ++-- thermosphere/src/traps/hvisor_traps_hvc.hpp | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/thermosphere/src/hvisor_exception_dispatcher.cpp b/thermosphere/src/hvisor_exception_dispatcher.cpp index c7068b597..b689e4363 100644 --- a/thermosphere/src/hvisor_exception_dispatcher.cpp +++ b/thermosphere/src/hvisor_exception_dispatcher.cpp @@ -19,6 +19,12 @@ #include "hvisor_fpu_register_cache.hpp" #include "hvisor_guest_timers.hpp" +#include "traps/hvisor_traps_data_abort.hpp" +#include "traps/hvisor_traps_hvc.hpp" +#include "traps/hvisor_traps_single_step.hpp" +#include "traps/hvisor_traps_smc.hpp" +#include "traps/hvisor_traps_sysreg.hpp" + #include "debug_manager.h" namespace ams::hvisor { @@ -69,7 +75,7 @@ void DumpStackFrame(ExceptionStackFrame *frame, bool sameEl) DEBUG("cntv_ctl_el0\t%016llx\n", frame->cntv_ctl_el0); } else if ((frame->sp_el2 & ~0xFFFul) + 0x1000 == stackTop) { // Try to dump the stack (comment if this crashes) - u64 *sp = (u64 *)frame->sp_el2; + u64 *sp = reinterpret_cast(frame->sp_el2); u64 *spEnd = sp + 0x20; u64 *spMax = reinterpret_cast((frame->sp_el2 + 0xFFF) & ~0xFFFul); DEBUG("Stack trace:\n"); @@ -119,32 +125,32 @@ void DumpStackFrame(ExceptionStackFrame *frame, bool sameEl) auto esr = frame->esr_el2; switch (esr.ec) { case cpu::ExceptionSyndromeRegister::CP15RTTrap: - handleMcrMrcCP15Trap(frame, esr); + traps::HandleMcrMrcCP15Trap(frame, esr); break; case cpu::ExceptionSyndromeRegister::CP15RRTTrap: - handleMcrrMrrcCP15Trap(frame, esr); + traps::HandleMcrrMrrcCP15Trap(frame, esr); break; case cpu::ExceptionSyndromeRegister::CP14RTTrap: case cpu::ExceptionSyndromeRegister::CP14DTTrap: case cpu::ExceptionSyndromeRegister::CP14RRTTrap: // A32 stub: Skip instruction, read 0 if necessary (there are debug regs at EL0) - handleA32CP14Trap(frame, esr); + traps::HandleA32CP14Trap(frame, esr); break; case cpu::ExceptionSyndromeRegister::HypervisorCallA64: - handleHypercall(frame, esr); + traps::HandleHvc(frame, esr); break; case cpu::ExceptionSyndromeRegister::MonitorCallA64: - handleSmcTrap(frame, esr); + traps::HandleSmc(frame, esr); break; case cpu::ExceptionSyndromeRegister::SystemRegisterTrap: - handleMsrMrsTrap(frame, esr); + traps::HandleMsrMrsTrap(frame, esr); break; case cpu::ExceptionSyndromeRegister::DataAbortLowerEl: // Basically, stage2 translation faults - handleLowerElDataAbortException(frame, esr); + traps::HandleLowerElDataAbort(frame, esr); break; case cpu::ExceptionSyndromeRegister::SoftwareStepLowerEl: - handleSingleStep(frame, esr); + traps::HandleSingleStep(frame, esr); break; case cpu::ExceptionSyndromeRegister::BreakpointLowerEl: case cpu::ExceptionSyndromeRegister::WatchpointLowerEl: diff --git a/thermosphere/src/traps/hvisor_traps_hvc.cpp b/thermosphere/src/traps/hvisor_traps_hvc.cpp index 6cd7c7ac9..6d4c3c2de 100644 --- a/thermosphere/src/traps/hvisor_traps_hvc.cpp +++ b/thermosphere/src/traps/hvisor_traps_hvc.cpp @@ -19,7 +19,7 @@ namespace ams::hvisor::traps { - void HandleHypercall(ExceptionStackFrame *frame, cpu::ExceptionSyndromeRegister esr) + void HandleHvc(ExceptionStackFrame *frame, cpu::ExceptionSyndromeRegister esr) { u32 id = esr.iss; switch (id) { @@ -30,4 +30,4 @@ namespace ams::hvisor::traps { } } -} \ No newline at end of file +} diff --git a/thermosphere/src/traps/hvisor_traps_hvc.hpp b/thermosphere/src/traps/hvisor_traps_hvc.hpp index 8178795f1..1bab1f46f 100644 --- a/thermosphere/src/traps/hvisor_traps_hvc.hpp +++ b/thermosphere/src/traps/hvisor_traps_hvc.hpp @@ -20,6 +20,6 @@ namespace ams::hvisor::traps { - void HandleHypercall(ExceptionStackFrame *frame, cpu::ExceptionSyndromeRegister esr); + void HandleHvc(ExceptionStackFrame *frame, cpu::ExceptionSyndromeRegister esr); -} \ No newline at end of file +}