summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-03-05 12:28:10 -0500
committerGravatar Lioncash2019-03-05 15:47:03 -0500
commitc161389a0f0b0fe3b9d6400c45fd87152f2cb14c (patch)
treeb050bdbd77611a1205028b6307f4aca72e1c7417 /src/core/hle/kernel/kernel.cpp
parentkernel/address_arbiter: Minor tidying up (diff)
downloadyuzu-c161389a0f0b0fe3b9d6400c45fd87152f2cb14c.tar.gz
yuzu-c161389a0f0b0fe3b9d6400c45fd87152f2cb14c.tar.xz
yuzu-c161389a0f0b0fe3b9d6400c45fd87152f2cb14c.zip
kernel/address_arbiter: Pass in system instance to constructor
Allows getting rid of reliance on the global accessor functions and instead operating on the provided system instance.
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r--src/core/hle/kernel/kernel.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index b771a33a6..04ea9349e 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -87,11 +87,13 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] int cycles_
87} 87}
88 88
89struct KernelCore::Impl { 89struct KernelCore::Impl {
90 void Initialize(KernelCore& kernel, Core::Timing::CoreTiming& core_timing) { 90 explicit Impl(Core::System& system) : address_arbiter{system}, system{system} {}
91
92 void Initialize(KernelCore& kernel) {
91 Shutdown(); 93 Shutdown();
92 94
93 InitializeSystemResourceLimit(kernel); 95 InitializeSystemResourceLimit(kernel);
94 InitializeThreads(core_timing); 96 InitializeThreads();
95 } 97 }
96 98
97 void Shutdown() { 99 void Shutdown() {
@@ -123,9 +125,9 @@ struct KernelCore::Impl {
123 ASSERT(system_resource_limit->SetLimitValue(ResourceType::Sessions, 900).IsSuccess()); 125 ASSERT(system_resource_limit->SetLimitValue(ResourceType::Sessions, 900).IsSuccess());
124 } 126 }
125 127
126 void InitializeThreads(Core::Timing::CoreTiming& core_timing) { 128 void InitializeThreads() {
127 thread_wakeup_event_type = 129 thread_wakeup_event_type =
128 core_timing.RegisterEvent("ThreadWakeupCallback", ThreadWakeupCallback); 130 system.CoreTiming().RegisterEvent("ThreadWakeupCallback", ThreadWakeupCallback);
129 } 131 }
130 132
131 std::atomic<u32> next_object_id{0}; 133 std::atomic<u32> next_object_id{0};
@@ -148,15 +150,18 @@ struct KernelCore::Impl {
148 /// Map of named ports managed by the kernel, which can be retrieved using 150 /// Map of named ports managed by the kernel, which can be retrieved using
149 /// the ConnectToPort SVC. 151 /// the ConnectToPort SVC.
150 NamedPortTable named_ports; 152 NamedPortTable named_ports;
153
154 // System context
155 Core::System& system;
151}; 156};
152 157
153KernelCore::KernelCore() : impl{std::make_unique<Impl>()} {} 158KernelCore::KernelCore(Core::System& system) : impl{std::make_unique<Impl>(system)} {}
154KernelCore::~KernelCore() { 159KernelCore::~KernelCore() {
155 Shutdown(); 160 Shutdown();
156} 161}
157 162
158void KernelCore::Initialize(Core::Timing::CoreTiming& core_timing) { 163void KernelCore::Initialize() {
159 impl->Initialize(*this, core_timing); 164 impl->Initialize(*this);
160} 165}
161 166
162void KernelCore::Shutdown() { 167void KernelCore::Shutdown() {