mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-19 08:52:25 +00:00
thermosphere: reload debug registers (refactored)
This commit is contained in:
parent
6bcb5aca60
commit
f40c064e80
2 changed files with 28 additions and 2 deletions
|
@ -20,13 +20,26 @@
|
||||||
#define _REENT_ONLY
|
#define _REENT_ONLY
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
|
// Can't use two THERMOSPHERE_SAVE_SYSREG as it prevents ldp from being generated
|
||||||
|
#define SAVE_BREAKPOINT(i, _)\
|
||||||
|
__asm__ __volatile__ (\
|
||||||
|
"msr " STRINGIZE(dbgbvr##i##_el1) ", %0\n"\
|
||||||
|
"msr " STRINGIZE(dbgbcr##i##_el1) ", %1"\
|
||||||
|
:\
|
||||||
|
: "r"(m_stopPoints[i].vr), "r"(m_stopPoints[i].cr.raw)\
|
||||||
|
: "memory"\
|
||||||
|
);
|
||||||
|
|
||||||
namespace ams::hvisor {
|
namespace ams::hvisor {
|
||||||
|
|
||||||
HwBreakpointManager HwBreakpointManager::instance{};
|
HwBreakpointManager HwBreakpointManager::instance{};
|
||||||
|
|
||||||
void HwBreakpointManager::Reload() const
|
void HwBreakpointManager::Reload() const
|
||||||
{
|
{
|
||||||
// TODO
|
cpu::dmb();
|
||||||
|
EVAL(REPEAT(MAX_BCR, SAVE_BREAKPOINT, ~));
|
||||||
|
cpu::dsb();
|
||||||
|
cpu::isb();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HwBreakpointManager::FindPredicate(const cpu::DebugRegisterPair &pair, uintptr_t addr, size_t, cpu::DebugRegisterPair::LoadStoreControl) const
|
bool HwBreakpointManager::FindPredicate(const cpu::DebugRegisterPair &pair, uintptr_t addr, size_t, cpu::DebugRegisterPair::LoadStoreControl) const
|
||||||
|
|
|
@ -21,6 +21,16 @@
|
||||||
#define _REENT_ONLY
|
#define _REENT_ONLY
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
|
// Can't use two THERMOSPHERE_SAVE_SYSREG as it prevents ldp from being generated
|
||||||
|
#define SAVE_WATCHPOINT(i, _)\
|
||||||
|
__asm__ __volatile__ (\
|
||||||
|
"msr " STRINGIZE(dbgwvr##i##_el1) ", %0\n"\
|
||||||
|
"msr " STRINGIZE(dbgwcr##i##_el1) ", %1"\
|
||||||
|
:\
|
||||||
|
: "r"(m_stopPoints[i].vr), "r"(m_stopPoints[i].cr.raw)\
|
||||||
|
: "memory"\
|
||||||
|
);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr bool IsRangeMaskWatchpoint(uintptr_t addr, size_t size)
|
constexpr bool IsRangeMaskWatchpoint(uintptr_t addr, size_t size)
|
||||||
|
@ -49,7 +59,10 @@ namespace ams::hvisor {
|
||||||
|
|
||||||
void WatchpointManager::Reload() const
|
void WatchpointManager::Reload() const
|
||||||
{
|
{
|
||||||
// TODO
|
cpu::dmb();
|
||||||
|
EVAL(REPEAT(MAX_WCR, SAVE_WATCHPOINT, ~));
|
||||||
|
cpu::dsb();
|
||||||
|
cpu::isb();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WatchpointManager::FindPredicate(const cpu::DebugRegisterPair &pair, uintptr_t addr, size_t size, cpu::DebugRegisterPair::LoadStoreControl direction) const
|
bool WatchpointManager::FindPredicate(const cpu::DebugRegisterPair &pair, uintptr_t addr, size_t size, cpu::DebugRegisterPair::LoadStoreControl direction) const
|
||||||
|
|
Loading…
Reference in a new issue