From 77fbbb4c68692935236088da5a52cdd6976aa883 Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Fri, 21 Feb 2020 00:20:50 +0000 Subject: [PATCH] thermosphere: singleton ctors should be private --- thermosphere/src/hvisor_hw_breakpoint_manager.hpp | 6 +++--- thermosphere/src/hvisor_irq_manager.hpp | 6 +++--- thermosphere/src/hvisor_sw_breakpoint_manager.hpp | 5 +++-- thermosphere/src/hvisor_virtual_gic.hpp | 3 +++ thermosphere/src/hvisor_watchpoint_manager.hpp | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/thermosphere/src/hvisor_hw_breakpoint_manager.hpp b/thermosphere/src/hvisor_hw_breakpoint_manager.hpp index 7057f1191..63e8add38 100644 --- a/thermosphere/src/hvisor_hw_breakpoint_manager.hpp +++ b/thermosphere/src/hvisor_hw_breakpoint_manager.hpp @@ -26,11 +26,11 @@ namespace ams::hvisor { bool FindPredicate(const cpu::DebugRegisterPair &pair, uintptr_t addr, size_t, cpu::DebugRegisterPair::LoadStoreControl) const final; void Reload() const final; + private: + constexpr HwBreakpointManager() : HwStopPointManager(MAX_BCR, IrqManager::ReloadHwBreakpointsSgi) {} + public: int Add(uintptr_t addr); int Remove(uintptr_t addr); - - public: - constexpr HwBreakpointManager() : HwStopPointManager(MAX_BCR, IrqManager::ReloadHwBreakpointsSgi) {} }; } diff --git a/thermosphere/src/hvisor_irq_manager.hpp b/thermosphere/src/hvisor_irq_manager.hpp index fffaa17ca..717713fb9 100644 --- a/thermosphere/src/hvisor_irq_manager.hpp +++ b/thermosphere/src/hvisor_irq_manager.hpp @@ -79,6 +79,9 @@ namespace ams::hvisor { void InitializeGic(); void DoConfigureInterrupt(u32 id, u8 prio, bool isLevelSensitive); + private: + constexpr IrqManager() = default; + public: enum ThermosphereSgi : u32 { VgicUpdateSgi = 0, @@ -109,9 +112,6 @@ namespace ams::hvisor { void Initialize(); void Register(IInterruptTask &task, u32 id, bool isLevelSensitive, u8 prio = IrqManager::hostPriority); void SetInterruptAffinity(u32 id, u8 affinityMask); - - public: - constexpr IrqManager() = default; }; } diff --git a/thermosphere/src/hvisor_sw_breakpoint_manager.hpp b/thermosphere/src/hvisor_sw_breakpoint_manager.hpp index de46319c6..e852252a4 100644 --- a/thermosphere/src/hvisor_sw_breakpoint_manager.hpp +++ b/thermosphere/src/hvisor_sw_breakpoint_manager.hpp @@ -50,6 +50,9 @@ namespace ams::hvisor { bool ApplyOrRevert(size_t id, bool apply); + private: + constexpr SwBreakpointManager() = default; + public: int Add(uintptr_t addr, bool persistent); int Remove(uintptr_t addr, bool keepPersistent); @@ -60,7 +63,5 @@ namespace ams::hvisor { { IrqManager::GetInstance().Register(*this, IrqManager::ApplyRevertSwBreakpointSgi, false); } - public: - constexpr SwBreakpointManager() = default; }; } diff --git a/thermosphere/src/hvisor_virtual_gic.hpp b/thermosphere/src/hvisor_virtual_gic.hpp index d50102e00..1362a742e 100644 --- a/thermosphere/src/hvisor_virtual_gic.hpp +++ b/thermosphere/src/hvisor_virtual_gic.hpp @@ -366,6 +366,9 @@ namespace ams::hvisor { void PushListRegisters(VirqState *chosen[], size_t num); bool UpdateListRegister(volatile GicV2VirtualInterfaceController::ListRegister *lr); + private: + constexpr VirtualGic() = default; + public: static bool ValidateGicdRegisterAccess(size_t offset, size_t sz); public: diff --git a/thermosphere/src/hvisor_watchpoint_manager.hpp b/thermosphere/src/hvisor_watchpoint_manager.hpp index e1c864e73..6edac5b68 100644 --- a/thermosphere/src/hvisor_watchpoint_manager.hpp +++ b/thermosphere/src/hvisor_watchpoint_manager.hpp @@ -26,6 +26,9 @@ namespace ams::hvisor { bool FindPredicate(const cpu::DebugRegisterPair &pair, uintptr_t addr, size_t size, cpu::DebugRegisterPair::LoadStoreControl direction) const final; void Reload() const final; + private: + constexpr WatchpointManager() : HwStopPointManager(MAX_WCR, IrqManager::ReloadWatchpointsSgi) {} + public: virtual void ReloadOnAllCores() const; static void ReloadOnAllCoresSgiHandler(); @@ -33,8 +36,5 @@ namespace ams::hvisor { cpu::DebugRegisterPair RetrieveWatchpointConfig(uintptr_t addr, cpu::DebugRegisterPair::LoadStoreControl direction) const; int Add(uintptr_t addr, size_t size, cpu::DebugRegisterPair::LoadStoreControl direction); int Remove(uintptr_t addr, size_t size, cpu::DebugRegisterPair::LoadStoreControl direction); - - public: - constexpr WatchpointManager() : HwStopPointManager(MAX_WCR, IrqManager::ReloadWatchpointsSgi) {} }; }