thermopshere: interrupt refactoring

This commit is contained in:
TuxSH
2020-02-16 01:19:19 +00:00
parent 1ee289f5f1
commit 2574f68484
14 changed files with 205 additions and 148 deletions

View File

@@ -15,6 +15,8 @@
*/
#include "hvisor_hw_stop_point_manager.hpp"
#include "cpu/hvisor_cpu_instructions.hpp"
#include "cpu/hvisor_cpu_interrupt_mask_guard.hpp"
#include <mutex>
#define _REENT_ONLY
@@ -22,6 +24,16 @@
namespace ams::hvisor {
void HwStopPointManager::DoReloadOnAllCores() const
{
cpu::InterruptMaskGuard mg{};
cpu::dmb();
Reload();
m_reloadBarrier.Reset(getActiveCoreMask());
IrqManager::GenerateSgiForAllOthers(m_irqId);
m_reloadBarrier.Join();
}
cpu::DebugRegisterPair *HwStopPointManager::Allocate()
{
size_t pos = __builtin_ffs(m_freeBitmap);
@@ -76,7 +88,7 @@ namespace ams::hvisor {
regs->vr = preconfiguredPair.vr;
regs->cr.enabled = true;
ReloadOnAllCores();
DoReloadOnAllCores();
return 0;
}
@@ -98,7 +110,16 @@ namespace ams::hvisor {
m_freeBitmap |= m_usedBitmap;
m_usedBitmap = 0;
std::fill(m_stopPoints.begin(), m_stopPoints.end(), cpu::DebugRegisterPair{});
ReloadOnAllCores();
DoReloadOnAllCores();
}
std::optional<bool> HwStopPointManager::InterruptTopHalfHandler(u32 irqId, u32)
{
if (irqId != m_irqId) {
return {};
}
Reload();
return false;
}
}