mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-18 08:22:04 +00:00
thermosphere: add singleton define
This commit is contained in:
parent
c99a77a0c3
commit
b21c75b22b
5 changed files with 12 additions and 22 deletions
|
@ -26,3 +26,11 @@
|
|||
|
||||
#include "preprocessor.h"
|
||||
#include "debug_log.h"
|
||||
|
||||
#define SINGLETON(cl) \
|
||||
NON_COPYABLE(cl);\
|
||||
NON_MOVEABLE(cl);\
|
||||
private:\
|
||||
static cl instance;\
|
||||
public:\
|
||||
static cl &GetInstance() { return instance; }
|
||||
|
|
|
@ -21,14 +21,10 @@
|
|||
namespace ams::hvisor {
|
||||
|
||||
class HwBreakpointManager final : public HwStopPointManager {
|
||||
SINGLETON(HwBreakpointManager);
|
||||
protected:
|
||||
virtual bool FindPredicate(const cpu::DebugRegisterPair &pair, uintptr_t addr, size_t, cpu::DebugRegisterPair::LoadStoreControl) const;
|
||||
|
||||
private:
|
||||
static HwBreakpointManager instance;
|
||||
public:
|
||||
static HwBreakpointManager &GetInstance() { return instance; }
|
||||
|
||||
public:
|
||||
virtual void ReloadOnAllCores() const;
|
||||
static void ReloadOnAllCoresSgiHandler();
|
||||
|
|
|
@ -25,11 +25,9 @@
|
|||
namespace ams::hvisor {
|
||||
|
||||
class IrqManager final {
|
||||
NON_COPYABLE(IrqManager);
|
||||
NON_MOVEABLE(IrqManager);
|
||||
SINGLETON(IrqManager);
|
||||
friend class VirtualGic;
|
||||
private:
|
||||
static IrqManager instance;
|
||||
static constexpr u8 hostPriority = 0;
|
||||
static constexpr u8 guestPriority = 1;
|
||||
|
||||
|
@ -92,8 +90,6 @@ namespace ams::hvisor {
|
|||
gicd->sgir = GicV2Distributor::ForwardToAllOthers << 24 | id;
|
||||
}
|
||||
|
||||
static IrqManager &GetInstance() { return instance; }
|
||||
|
||||
static void HandleInterrupt(ExceptionStackFrame *frame);
|
||||
|
||||
public:
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
namespace ams::hvisor {
|
||||
|
||||
class SwBreakpointManager {
|
||||
NON_COPYABLE(SwBreakpointManager);
|
||||
NON_MOVEABLE(SwBreakpointManager);
|
||||
SINGLETON(SwBreakpointManager);
|
||||
private:
|
||||
struct Breakpoint {
|
||||
uintptr_t address;
|
||||
|
@ -35,8 +34,6 @@ namespace ams::hvisor {
|
|||
bool applied;
|
||||
};
|
||||
|
||||
private:
|
||||
static SwBreakpointManager instance;
|
||||
private:
|
||||
mutable RecursiveSpinlock m_lock{};
|
||||
std::atomic<bool> m_triedToApplyOrRevertBreakpoint{};
|
||||
|
@ -55,9 +52,6 @@ namespace ams::hvisor {
|
|||
bool Apply(size_t id);
|
||||
bool Revert(size_t id);
|
||||
|
||||
public:
|
||||
static SwBreakpointManager &GetInstance() { return instance; }
|
||||
|
||||
public:
|
||||
int Add(uintptr_t addr, bool persistent);
|
||||
int Remove(uintptr_t addr, bool keepPersistent);
|
||||
|
|
|
@ -21,14 +21,10 @@
|
|||
namespace ams::hvisor {
|
||||
|
||||
class WatchpointManager final : public HwStopPointManager {
|
||||
SINGLETON(WatchpointManager);
|
||||
protected:
|
||||
virtual bool FindPredicate(const cpu::DebugRegisterPair &pair, uintptr_t addr, size_t size, cpu::DebugRegisterPair::LoadStoreControl direction) const;
|
||||
|
||||
private:
|
||||
static WatchpointManager instance;
|
||||
public:
|
||||
static WatchpointManager &GetInstance() { return instance; }
|
||||
|
||||
public:
|
||||
virtual void ReloadOnAllCores() const;
|
||||
static void ReloadOnAllCoresSgiHandler();
|
||||
|
|
Loading…
Reference in a new issue