diff options
| author | 2022-10-02 14:26:30 -0700 | |
|---|---|---|
| committer | 2022-10-18 19:13:35 -0700 | |
| commit | abcc009dff5d98b5a04229f3a82baab23d568244 (patch) | |
| tree | e51f99cf493425a3cd331ffdaa1b984554e429aa /src/core/hle/kernel/kernel.cpp | |
| parent | core: hle: kernel: k_interrupt_manager: HandleInterrupt should not depend on ... (diff) | |
| download | yuzu-abcc009dff5d98b5a04229f3a82baab23d568244.tar.gz yuzu-abcc009dff5d98b5a04229f3a82baab23d568244.tar.xz yuzu-abcc009dff5d98b5a04229f3a82baab23d568244.zip | |
core: hle: kernel: k_process: Improve management of page table & cleanup.
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index b6bbd4984..6879de9ef 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -95,6 +95,15 @@ struct KernelCore::Impl { | |||
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | void CloseCurrentProcess() { | ||
| 99 | (*current_process).Finalize(); | ||
| 100 | // current_process->Close(); | ||
| 101 | // TODO: The current process should be destroyed based on accurate ref counting after | ||
| 102 | // calling Close(). Adding a manual Destroy() call instead to avoid a memory leak. | ||
| 103 | (*current_process).Destroy(); | ||
| 104 | current_process = nullptr; | ||
| 105 | } | ||
| 106 | |||
| 98 | void Shutdown() { | 107 | void Shutdown() { |
| 99 | is_shutting_down.store(true, std::memory_order_relaxed); | 108 | is_shutting_down.store(true, std::memory_order_relaxed); |
| 100 | SCOPE_EXIT({ is_shutting_down.store(false, std::memory_order_relaxed); }); | 109 | SCOPE_EXIT({ is_shutting_down.store(false, std::memory_order_relaxed); }); |
| @@ -157,15 +166,7 @@ struct KernelCore::Impl { | |||
| 157 | } | 166 | } |
| 158 | } | 167 | } |
| 159 | 168 | ||
| 160 | // Shutdown all processes. | 169 | CloseCurrentProcess(); |
| 161 | if (current_process) { | ||
| 162 | (*current_process).Finalize(); | ||
| 163 | // current_process->Close(); | ||
| 164 | // TODO: The current process should be destroyed based on accurate ref counting after | ||
| 165 | // calling Close(). Adding a manual Destroy() call instead to avoid a memory leak. | ||
| 166 | (*current_process).Destroy(); | ||
| 167 | current_process = nullptr; | ||
| 168 | } | ||
| 169 | 170 | ||
| 170 | // Track kernel objects that were not freed on shutdown | 171 | // Track kernel objects that were not freed on shutdown |
| 171 | { | 172 | { |
| @@ -870,6 +871,10 @@ const KProcess* KernelCore::CurrentProcess() const { | |||
| 870 | return impl->current_process; | 871 | return impl->current_process; |
| 871 | } | 872 | } |
| 872 | 873 | ||
| 874 | void KernelCore::CloseCurrentProcess() { | ||
| 875 | impl->CloseCurrentProcess(); | ||
| 876 | } | ||
| 877 | |||
| 873 | const std::vector<KProcess*>& KernelCore::GetProcessList() const { | 878 | const std::vector<KProcess*>& KernelCore::GetProcessList() const { |
| 874 | return impl->process_list; | 879 | return impl->process_list; |
| 875 | } | 880 | } |