Kernel: add KernelSystem class

This commit is contained in:
Weiyi Wang 2018-10-11 14:49:52 -04:00
parent 1de63f9b16
commit f446fd1fe5
4 changed files with 29 additions and 9 deletions

View File

@ -196,7 +196,7 @@ System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) {
archive_manager = std::make_unique<Service::FS::ArchiveManager>();
HW::Init();
Kernel::Init(system_mode);
kernel = std::make_unique<Kernel::KernelSystem>(system_mode);
Service::Init(*this, service_manager);
GDBStub::Init();
@ -230,6 +230,14 @@ const Service::FS::ArchiveManager& System::ArchiveManager() const {
return *archive_manager;
}
Kernel::KernelSystem& System::Kernel() {
return *kernel;
}
const Kernel::KernelSystem& System::Kernel() const {
return *kernel;
}
void System::RegisterSoftwareKeyboard(std::shared_ptr<Frontend::SoftwareKeyboard> swkbd) {
registered_swkbd = std::move(swkbd);
}
@ -248,7 +256,7 @@ void System::Shutdown() {
GDBStub::Shutdown();
VideoCore::Shutdown();
Service::Shutdown();
Kernel::Shutdown();
kernel.reset();
HW::Shutdown();
telemetry_session.reset();
#ifdef ENABLE_SCRIPTING

View File

@ -36,6 +36,10 @@ class ArchiveManager;
}
} // namespace Service
namespace Kernel {
class KernelSystem;
}
namespace Core {
class System {
@ -167,6 +171,12 @@ public:
/// Gets a const reference to the archive manager
const Service::FS::ArchiveManager& ArchiveManager() const;
/// Gets a reference to the kernel
Kernel::KernelSystem& Kernel();
/// Gets a const reference to the kernel
const Kernel::KernelSystem& Kernel() const;
PerfStats perf_stats;
FrameLimiter frame_limiter;
@ -241,6 +251,8 @@ private:
std::unique_ptr<Service::FS::ArchiveManager> archive_manager;
std::unique_ptr<Kernel::KernelSystem> kernel;
static System s_instance;
ResultStatus status = ResultStatus::Success;

View File

@ -17,7 +17,7 @@ namespace Kernel {
std::atomic<u32> Object::next_object_id{0};
/// Initialize the kernel
void Init(u32 system_mode) {
KernelSystem::KernelSystem(u32 system_mode) {
ConfigMem::Init();
Kernel::MemoryInit(system_mode);
@ -33,7 +33,7 @@ void Init(u32 system_mode) {
}
/// Shutdown the kernel
void Shutdown() {
KernelSystem::~KernelSystem() {
g_handle_table.Clear(); // Free all kernel objects
Kernel::ThreadingShutdown();

View File

@ -8,10 +8,10 @@
namespace Kernel {
/// Initialize the kernel with the specified system mode.
void Init(u32 system_mode);
/// Shutdown the kernel
void Shutdown();
class KernelSystem {
public:
explicit KernelSystem(u32 system_mode);
~KernelSystem();
};
} // namespace Kernel