summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-10-10 00:42:10 -0400
committerGravatar Lioncash2018-10-10 02:04:55 -0400
commit5c0408596f6ccf5d2b171321bac386713b169d5b (patch)
tree1c5d3e1b178d7252cd3e752d8f2a99017a0ecb6d /src/core/hle/kernel/svc.cpp
parentMerge pull request #1461 from lioncash/warn (diff)
downloadyuzu-5c0408596f6ccf5d2b171321bac386713b169d5b.tar.gz
yuzu-5c0408596f6ccf5d2b171321bac386713b169d5b.tar.xz
yuzu-5c0408596f6ccf5d2b171321bac386713b169d5b.zip
kernel/thread: Use a regular pointer for the owner/current process
There's no real need to use a shared pointer in these cases, and only makes object management more fragile in terms of how easy it would be to introduce cycles. Instead, just do the simple thing of using a regular pointer. Much of this is just a hold-over from citra anyways. It also doesn't make sense from a behavioral point of view for a process' thread to prolong the lifetime of the process itself (the process is supposed to own the thread, not the other way around).
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index b488b508d..3afcce3fe 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -341,7 +341,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
341 LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, 341 LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id,
342 info_sub_id, handle); 342 info_sub_id, handle);
343 343
344 const auto& current_process = Core::CurrentProcess(); 344 const auto* current_process = Core::CurrentProcess();
345 const auto& vm_manager = current_process->VMManager(); 345 const auto& vm_manager = current_process->VMManager();
346 346
347 switch (static_cast<GetInfoType>(info_id)) { 347 switch (static_cast<GetInfoType>(info_id)) {
@@ -439,7 +439,7 @@ static ResultCode GetThreadContext(VAddr thread_context, Handle handle) {
439 return ERR_INVALID_HANDLE; 439 return ERR_INVALID_HANDLE;
440 } 440 }
441 441
442 const auto current_process = Core::CurrentProcess(); 442 const auto* current_process = Core::CurrentProcess();
443 if (thread->GetOwnerProcess() != current_process) { 443 if (thread->GetOwnerProcess() != current_process) {
444 return ERR_INVALID_HANDLE; 444 return ERR_INVALID_HANDLE;
445 } 445 }
@@ -531,7 +531,7 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s
531 return ERR_INVALID_HANDLE; 531 return ERR_INVALID_HANDLE;
532 } 532 }
533 533
534 return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type, 534 return shared_memory->Map(Core::CurrentProcess(), addr, permissions_type,
535 MemoryPermission::DontCare); 535 MemoryPermission::DontCare);
536} 536}
537 537
@@ -550,7 +550,7 @@ static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64
550 auto& kernel = Core::System::GetInstance().Kernel(); 550 auto& kernel = Core::System::GetInstance().Kernel();
551 auto shared_memory = kernel.HandleTable().Get<SharedMemory>(shared_memory_handle); 551 auto shared_memory = kernel.HandleTable().Get<SharedMemory>(shared_memory_handle);
552 552
553 return shared_memory->Unmap(Core::CurrentProcess().get(), addr); 553 return shared_memory->Unmap(Core::CurrentProcess(), addr);
554} 554}
555 555
556/// Query process memory 556/// Query process memory
@@ -588,7 +588,7 @@ static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAdd
588 588
589/// Exits the current process 589/// Exits the current process
590static void ExitProcess() { 590static void ExitProcess() {
591 auto& current_process = Core::CurrentProcess(); 591 auto* current_process = Core::CurrentProcess();
592 592
593 LOG_INFO(Kernel_SVC, "Process {} exiting", current_process->GetProcessID()); 593 LOG_INFO(Kernel_SVC, "Process {} exiting", current_process->GetProcessID());
594 ASSERT_MSG(current_process->GetStatus() == ProcessStatus::Running, 594 ASSERT_MSG(current_process->GetStatus() == ProcessStatus::Running,
@@ -636,7 +636,7 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
636 auto& kernel = Core::System::GetInstance().Kernel(); 636 auto& kernel = Core::System::GetInstance().Kernel();
637 CASCADE_RESULT(SharedPtr<Thread> thread, 637 CASCADE_RESULT(SharedPtr<Thread> thread,
638 Thread::Create(kernel, name, entry_point, priority, arg, processor_id, stack_top, 638 Thread::Create(kernel, name, entry_point, priority, arg, processor_id, stack_top,
639 Core::CurrentProcess())); 639 *Core::CurrentProcess()));
640 const auto new_guest_handle = kernel.HandleTable().Create(thread); 640 const auto new_guest_handle = kernel.HandleTable().Create(thread);
641 if (new_guest_handle.Failed()) { 641 if (new_guest_handle.Failed()) {
642 return new_guest_handle.Code(); 642 return new_guest_handle.Code();