From 5b56d05e11f6887852a4051d394d2436a9c8f241 Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Sun, 23 Feb 2020 00:27:54 +0000 Subject: [PATCH] thermosphere: move EnterInterruptibleHypervisorCode into IrqManager --- ...ion_frame.hpp => hvisor_exception_stack_frame.hpp} | 0 thermosphere/src/hvisor_irq_manager.cpp | 2 +- thermosphere/src/hvisor_irq_manager.hpp | 11 +++++++++-- thermosphere/src/hvisor_virtual_gic.hpp | 1 - 4 files changed, 10 insertions(+), 4 deletions(-) rename thermosphere/src/{hvisor_exception_frame.hpp => hvisor_exception_stack_frame.hpp} (100%) diff --git a/thermosphere/src/hvisor_exception_frame.hpp b/thermosphere/src/hvisor_exception_stack_frame.hpp similarity index 100% rename from thermosphere/src/hvisor_exception_frame.hpp rename to thermosphere/src/hvisor_exception_stack_frame.hpp diff --git a/thermosphere/src/hvisor_irq_manager.cpp b/thermosphere/src/hvisor_irq_manager.cpp index 1d1a9002e..0641a1e41 100644 --- a/thermosphere/src/hvisor_irq_manager.cpp +++ b/thermosphere/src/hvisor_irq_manager.cpp @@ -233,7 +233,7 @@ namespace ams::hvisor { if (taskForBottomHalf != nullptr) { // Unmasking the irq signal is left at the discretion of the bottom half handler - exceptionEnterInterruptibleHypervisorCode(); + EnterInterruptibleHypervisorCode(); taskForBottomHalf->InterruptBottomHalfHandler(irqId, srcCore); } } diff --git a/thermosphere/src/hvisor_irq_manager.hpp b/thermosphere/src/hvisor_irq_manager.hpp index 717713fb9..5c5cbfe75 100644 --- a/thermosphere/src/hvisor_irq_manager.hpp +++ b/thermosphere/src/hvisor_irq_manager.hpp @@ -19,11 +19,11 @@ #include "hvisor_gicv2.hpp" #include "hvisor_synchronization.hpp" #include "hvisor_i_interrupt_task.hpp" +#include "hvisor_exception_stack_frame.hpp" +#include "cpu/hvisor_cpu_sysreg_general.hpp" #include "memory_map.h" -#include "exceptions.h" // TODO - namespace ams::hvisor { class IrqManager final { @@ -106,6 +106,13 @@ namespace ams::hvisor { gicd->sgir = GicV2Distributor::ForwardToAllOthers << 24 | id; } + static void EnterInterruptibleHypervisorCode() + { + // We don't want the guest to spam us with its timer interrupts. Disable the timers. + THERMOSPHERE_SET_SYSREG(cntp_ctl_el0, 0); + THERMOSPHERE_SET_SYSREG(cntv_ctl_el0, 0); + } + static void HandleInterrupt(ExceptionStackFrame *frame); public: diff --git a/thermosphere/src/hvisor_virtual_gic.hpp b/thermosphere/src/hvisor_virtual_gic.hpp index 1362a742e..c09f4a63f 100644 --- a/thermosphere/src/hvisor_virtual_gic.hpp +++ b/thermosphere/src/hvisor_virtual_gic.hpp @@ -17,7 +17,6 @@ #pragma once #include "defines.hpp" -#include "exceptions.h" #include "cpu/hvisor_cpu_exception_sysregs.hpp" #include "hvisor_irq_manager.hpp" #include "memory_map.h"