summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-09-20 21:09:57 -0400
committerGravatar Lioncash2018-09-20 21:10:00 -0400
commit05aa4aa01a0f9b9e3a5a0ea47b0d5719befce9b4 (patch)
tree51d0560e5b690aa36554232f138bdac154865af7 /src/core/hle/kernel/thread.cpp
parentMerge pull request #1370 from Hedges/GDBClean (diff)
downloadyuzu-05aa4aa01a0f9b9e3a5a0ea47b0d5719befce9b4.tar.gz
yuzu-05aa4aa01a0f9b9e3a5a0ea47b0d5719befce9b4.tar.xz
yuzu-05aa4aa01a0f9b9e3a5a0ea47b0d5719befce9b4.zip
kernel/thread: Use owner_process when setting the page table in SetupMainThread()
The owning process of a thread is required to exist before the thread, so we can enforce this API-wise by using a reference. We can also avoid the reliance on the system instance by using that parameter to access the page table that needs to be set.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index d4183d6e3..c2d7535c9 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -311,13 +311,13 @@ void Thread::BoostPriority(u32 priority) {
311} 311}
312 312
313SharedPtr<Thread> SetupMainThread(KernelCore& kernel, VAddr entry_point, u32 priority, 313SharedPtr<Thread> SetupMainThread(KernelCore& kernel, VAddr entry_point, u32 priority,
314 SharedPtr<Process> owner_process) { 314 Process& owner_process) {
315 // Setup page table so we can write to memory 315 // Setup page table so we can write to memory
316 SetCurrentPageTable(&Core::CurrentProcess()->vm_manager.page_table); 316 SetCurrentPageTable(&owner_process.vm_manager.page_table);
317 317
318 // Initialize new "main" thread 318 // Initialize new "main" thread
319 auto thread_res = Thread::Create(kernel, "main", entry_point, priority, 0, THREADPROCESSORID_0, 319 auto thread_res = Thread::Create(kernel, "main", entry_point, priority, 0, THREADPROCESSORID_0,
320 Memory::STACK_AREA_VADDR_END, std::move(owner_process)); 320 Memory::STACK_AREA_VADDR_END, &owner_process);
321 321
322 SharedPtr<Thread> thread = std::move(thread_res).Unwrap(); 322 SharedPtr<Thread> thread = std::move(thread_res).Unwrap();
323 323