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