kernel/process: move current process to kernel instance

Two functional change:
QueryProcessMemory uses the process passed from handle instead current_process
Thread::Stop() uses TLS from owner_process instead of current_process
This commit is contained in:
Weiyi Wang 2018-10-17 15:23:56 -04:00
parent d9342622b0
commit 8fb3d8ff38
19 changed files with 96 additions and 55 deletions

View file

@ -126,7 +126,9 @@ System::ResultStatus System::Load(EmuWindow& emu_window, const std::string& file
return init_result;
}
const Loader::ResultStatus load_result{app_loader->Load(Kernel::g_current_process)};
Kernel::SharedPtr<Kernel::Process> process;
const Loader::ResultStatus load_result{app_loader->Load(process)};
kernel->SetCurrentProcess(process);
if (Loader::ResultStatus::Success != load_result) {
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<u32>(load_result));
System::Shutdown();
@ -140,7 +142,7 @@ System::ResultStatus System::Load(EmuWindow& emu_window, const std::string& file
return ResultStatus::ErrorLoader;
}
}
Memory::SetCurrentPageTable(&Kernel::g_current_process->vm_manager.page_table);
Memory::SetCurrentPageTable(&kernel->GetCurrentProcess()->vm_manager.page_table);
status = ResultStatus::Success;
m_emu_window = &emu_window;
m_filepath = filepath;