diff options
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 1 |
3 files changed, 2 insertions, 4 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 3f14bfa86..4d58e7c69 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include "core/hle/kernel/thread.h" | 21 | #include "core/hle/kernel/thread.h" |
| 22 | #include "core/hle/lock.h" | 22 | #include "core/hle/lock.h" |
| 23 | #include "core/hle/result.h" | 23 | #include "core/hle/result.h" |
| 24 | #include "core/memory.h" | ||
| 24 | 25 | ||
| 25 | namespace Kernel { | 26 | namespace Kernel { |
| 26 | 27 | ||
| @@ -181,6 +182,7 @@ void KernelCore::AppendNewProcess(SharedPtr<Process> process) { | |||
| 181 | 182 | ||
| 182 | void KernelCore::MakeCurrentProcess(Process* process) { | 183 | void KernelCore::MakeCurrentProcess(Process* process) { |
| 183 | impl->current_process = process; | 184 | impl->current_process = process; |
| 185 | Memory::SetCurrentPageTable(&process->VMManager().page_table); | ||
| 184 | } | 186 | } |
| 185 | 187 | ||
| 186 | Process* KernelCore::CurrentProcess() { | 188 | Process* KernelCore::CurrentProcess() { |
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 041267318..26c6b95ab 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -32,9 +32,6 @@ namespace { | |||
| 32 | * @param priority The priority to give the main thread | 32 | * @param priority The priority to give the main thread |
| 33 | */ | 33 | */ |
| 34 | void SetupMainThread(Process& owner_process, KernelCore& kernel, VAddr entry_point, u32 priority) { | 34 | void SetupMainThread(Process& owner_process, KernelCore& kernel, VAddr entry_point, u32 priority) { |
| 35 | // Setup page table so we can write to memory | ||
| 36 | Memory::SetCurrentPageTable(&owner_process.VMManager().page_table); | ||
| 37 | |||
| 38 | // Initialize new "main" thread | 35 | // Initialize new "main" thread |
| 39 | const VAddr stack_top = owner_process.VMManager().GetTLSIORegionEndAddress(); | 36 | const VAddr stack_top = owner_process.VMManager().GetTLSIORegionEndAddress(); |
| 40 | auto thread_res = Thread::Create(kernel, "main", entry_point, priority, 0, | 37 | auto thread_res = Thread::Create(kernel, "main", entry_point, priority, 0, |
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index ac501bf7f..e8447b69a 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -101,7 +101,6 @@ void Scheduler::SwitchContext(Thread* new_thread) { | |||
| 101 | auto* const thread_owner_process = current_thread->GetOwnerProcess(); | 101 | auto* const thread_owner_process = current_thread->GetOwnerProcess(); |
| 102 | if (previous_process != thread_owner_process) { | 102 | if (previous_process != thread_owner_process) { |
| 103 | system.Kernel().MakeCurrentProcess(thread_owner_process); | 103 | system.Kernel().MakeCurrentProcess(thread_owner_process); |
| 104 | Memory::SetCurrentPageTable(&thread_owner_process->VMManager().page_table); | ||
| 105 | } | 104 | } |
| 106 | 105 | ||
| 107 | cpu_core.LoadContext(new_thread->GetContext()); | 106 | cpu_core.LoadContext(new_thread->GetContext()); |