core: hle: kernel: k_process: Improve management of page table & cleanup.

This commit is contained in:
bunnei 2022-10-02 14:26:30 -07:00
parent 79bcb38321
commit abcc009dff
7 changed files with 92 additions and 60 deletions

View file

@ -95,6 +95,15 @@ struct KernelCore::Impl {
}
}
void CloseCurrentProcess() {
(*current_process).Finalize();
// current_process->Close();
// TODO: The current process should be destroyed based on accurate ref counting after
// calling Close(). Adding a manual Destroy() call instead to avoid a memory leak.
(*current_process).Destroy();
current_process = nullptr;
}
void Shutdown() {
is_shutting_down.store(true, std::memory_order_relaxed);
SCOPE_EXIT({ is_shutting_down.store(false, std::memory_order_relaxed); });
@ -157,15 +166,7 @@ struct KernelCore::Impl {
}
}
// Shutdown all processes.
if (current_process) {
(*current_process).Finalize();
// current_process->Close();
// TODO: The current process should be destroyed based on accurate ref counting after
// calling Close(). Adding a manual Destroy() call instead to avoid a memory leak.
(*current_process).Destroy();
current_process = nullptr;
}
CloseCurrentProcess();
// Track kernel objects that were not freed on shutdown
{
@ -870,6 +871,10 @@ const KProcess* KernelCore::CurrentProcess() const {
return impl->current_process;
}
void KernelCore::CloseCurrentProcess() {
impl->CloseCurrentProcess();
}
const std::vector<KProcess*>& KernelCore::GetProcessList() const {
return impl->process_list;
}