summaryrefslogtreecommitdiff
path: root/src/core/hle/service/am
diff options
context:
space:
mode:
authorGravatar Lioncash2018-08-28 12:30:33 -0400
committerGravatar Lioncash2018-08-28 22:31:51 -0400
commit0cbcd6ec9aeeafc298fe2e6e4ac10d68bb7267c5 (patch)
tree2d7bb143d490c3984bff6deda426b818bf27d552 /src/core/hle/service/am
parentMerge pull request #1193 from lioncash/priv (diff)
downloadyuzu-0cbcd6ec9aeeafc298fe2e6e4ac10d68bb7267c5.tar.gz
yuzu-0cbcd6ec9aeeafc298fe2e6e4ac10d68bb7267c5.tar.xz
yuzu-0cbcd6ec9aeeafc298fe2e6e4ac10d68bb7267c5.zip
kernel: Eliminate kernel global state
As means to pave the way for getting rid of global state within core, This eliminates kernel global state by removing all globals. Instead this introduces a KernelCore class which acts as a kernel instance. This instance lives in the System class, which keeps its lifetime contained to the lifetime of the System class. This also forces the kernel types to actually interact with the main kernel instance itself instead of having transient kernel state placed all over several translation units, keeping everything together. It also has a nice consequence of making dependencies much more explicit. This also makes our initialization a tad bit more correct. Previously we were creating a kernel process before the actual kernel was initialized, which doesn't really make much sense. The KernelCore class itself follows the PImpl idiom, which allows keeping all the implementation details sealed away from everything else, which forces the use of the exposed API and allows us to avoid any unnecessary inclusions within the main kernel header.
Diffstat (limited to 'src/core/hle/service/am')
-rw-r--r--src/core/hle/service/am/am.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 7e3cf6d58..818c03e0f 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -160,8 +160,9 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger
160 }; 160 };
161 RegisterHandlers(functions); 161 RegisterHandlers(functions);
162 162
163 auto& kernel = Core::System::GetInstance().Kernel();
163 launchable_event = 164 launchable_event =
164 Kernel::Event::Create(Kernel::ResetType::Sticky, "ISelfController:LaunchableEvent"); 165 Kernel::Event::Create(kernel, Kernel::ResetType::Sticky, "ISelfController:LaunchableEvent");
165} 166}
166 167
167void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { 168void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) {
@@ -332,7 +333,8 @@ ICommonStateGetter::ICommonStateGetter() : ServiceFramework("ICommonStateGetter"
332 }; 333 };
333 RegisterHandlers(functions); 334 RegisterHandlers(functions);
334 335
335 event = Kernel::Event::Create(Kernel::ResetType::OneShot, "ICommonStateGetter:Event"); 336 auto& kernel = Core::System::GetInstance().Kernel();
337 event = Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "ICommonStateGetter:Event");
336} 338}
337 339
338void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) { 340void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) {
@@ -505,7 +507,8 @@ public:
505 }; 507 };
506 RegisterHandlers(functions); 508 RegisterHandlers(functions);
507 509
508 state_changed_event = Kernel::Event::Create(Kernel::ResetType::OneShot, 510 auto& kernel = Core::System::GetInstance().Kernel();
511 state_changed_event = Kernel::Event::Create(kernel, Kernel::ResetType::OneShot,
509 "ILibraryAppletAccessor:StateChangedEvent"); 512 "ILibraryAppletAccessor:StateChangedEvent");
510 } 513 }
511 514