2014-12-16 21:38:14 -08:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
2014-11-19 00:49:13 -08:00
|
|
|
// Refer to the license.txt file included.
|
2014-05-09 19:11:18 -07:00
|
|
|
|
2015-08-05 17:26:52 -07:00
|
|
|
#include "core/hle/config_mem.h"
|
2017-05-29 16:45:42 -07:00
|
|
|
#include "core/hle/kernel/handle_table.h"
|
2016-09-20 23:52:38 -07:00
|
|
|
#include "core/hle/kernel/kernel.h"
|
2015-08-05 17:26:52 -07:00
|
|
|
#include "core/hle/kernel/memory.h"
|
2015-05-03 20:01:16 -07:00
|
|
|
#include "core/hle/kernel/process.h"
|
2015-08-05 17:26:52 -07:00
|
|
|
#include "core/hle/kernel/resource_limit.h"
|
2014-05-09 19:11:18 -07:00
|
|
|
#include "core/hle/kernel/thread.h"
|
2014-12-04 11:45:47 -08:00
|
|
|
#include "core/hle/kernel/timer.h"
|
2015-08-05 17:26:52 -07:00
|
|
|
#include "core/hle/shared_page.h"
|
2014-05-09 19:11:18 -07:00
|
|
|
|
2014-05-20 15:13:25 -07:00
|
|
|
namespace Kernel {
|
2014-05-09 19:11:18 -07:00
|
|
|
|
2014-06-10 19:43:50 -07:00
|
|
|
/// Initialize the kernel
|
2018-10-11 11:49:52 -07:00
|
|
|
KernelSystem::KernelSystem(u32 system_mode) {
|
2015-08-05 17:26:52 -07:00
|
|
|
ConfigMem::Init();
|
|
|
|
|
2016-11-19 17:40:04 -08:00
|
|
|
Kernel::MemoryInit(system_mode);
|
2015-08-05 17:26:52 -07:00
|
|
|
|
2018-10-13 13:41:34 -07:00
|
|
|
resource_limits = std::make_unique<ResourceLimitList>(*this);
|
2014-05-20 16:37:46 -07:00
|
|
|
Kernel::ThreadingInit();
|
2014-12-04 11:45:47 -08:00
|
|
|
Kernel::TimersInit();
|
2014-05-20 15:13:25 -07:00
|
|
|
}
|
|
|
|
|
2014-06-10 19:43:50 -07:00
|
|
|
/// Shutdown the kernel
|
2018-10-11 11:49:52 -07:00
|
|
|
KernelSystem::~KernelSystem() {
|
2014-05-20 16:37:46 -07:00
|
|
|
Kernel::ThreadingShutdown();
|
2015-08-05 17:26:52 -07:00
|
|
|
|
2014-12-04 11:45:47 -08:00
|
|
|
Kernel::TimersShutdown();
|
2015-08-05 17:26:52 -07:00
|
|
|
Kernel::MemoryShutdown();
|
2014-05-13 18:57:12 -07:00
|
|
|
}
|
2014-05-22 16:06:12 -07:00
|
|
|
|
2018-10-13 13:41:34 -07:00
|
|
|
ResourceLimitList& KernelSystem::ResourceLimit() {
|
|
|
|
return *resource_limits;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ResourceLimitList& KernelSystem::ResourceLimit() const {
|
|
|
|
return *resource_limits;
|
|
|
|
}
|
|
|
|
|
2018-10-13 14:24:51 -07:00
|
|
|
u32 KernelSystem::GenerateObjectID() {
|
|
|
|
return next_object_id++;
|
|
|
|
}
|
|
|
|
|
2018-10-17 12:23:56 -07:00
|
|
|
SharedPtr<Process> KernelSystem::GetCurrentProcess() const {
|
|
|
|
return current_process;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KernelSystem::SetCurrentProcess(SharedPtr<Process> process) {
|
|
|
|
current_process = std::move(process);
|
|
|
|
}
|
|
|
|
|
2018-03-09 09:54:43 -08:00
|
|
|
} // namespace Kernel
|