diff options
| -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 | ||||
| -rw-r--r-- | src/tests/core/arm/arm_test_common.cpp | 3 |
4 files changed, 3 insertions, 6 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()); |
diff --git a/src/tests/core/arm/arm_test_common.cpp b/src/tests/core/arm/arm_test_common.cpp index 3e1a735c3..58af41f6e 100644 --- a/src/tests/core/arm/arm_test_common.cpp +++ b/src/tests/core/arm/arm_test_common.cpp | |||
| @@ -17,7 +17,6 @@ TestEnvironment::TestEnvironment(bool mutable_memory_) | |||
| 17 | : mutable_memory(mutable_memory_), | 17 | : mutable_memory(mutable_memory_), |
| 18 | test_memory(std::make_shared<TestMemory>(this)), kernel{Core::System::GetInstance()} { | 18 | test_memory(std::make_shared<TestMemory>(this)), kernel{Core::System::GetInstance()} { |
| 19 | auto process = Kernel::Process::Create(Core::System::GetInstance(), ""); | 19 | auto process = Kernel::Process::Create(Core::System::GetInstance(), ""); |
| 20 | kernel.MakeCurrentProcess(process.get()); | ||
| 21 | page_table = &process->VMManager().page_table; | 20 | page_table = &process->VMManager().page_table; |
| 22 | 21 | ||
| 23 | std::fill(page_table->pointers.begin(), page_table->pointers.end(), nullptr); | 22 | std::fill(page_table->pointers.begin(), page_table->pointers.end(), nullptr); |
| @@ -28,7 +27,7 @@ TestEnvironment::TestEnvironment(bool mutable_memory_) | |||
| 28 | Memory::MapIoRegion(*page_table, 0x00000000, 0x80000000, test_memory); | 27 | Memory::MapIoRegion(*page_table, 0x00000000, 0x80000000, test_memory); |
| 29 | Memory::MapIoRegion(*page_table, 0x80000000, 0x80000000, test_memory); | 28 | Memory::MapIoRegion(*page_table, 0x80000000, 0x80000000, test_memory); |
| 30 | 29 | ||
| 31 | Memory::SetCurrentPageTable(page_table); | 30 | kernel.MakeCurrentProcess(process.get()); |
| 32 | } | 31 | } |
| 33 | 32 | ||
| 34 | TestEnvironment::~TestEnvironment() { | 33 | TestEnvironment::~TestEnvironment() { |