diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.h | 6 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 18 |
3 files changed, 12 insertions, 16 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 87a0dbe37..b5c98b249 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -137,8 +137,10 @@ void Init() { | |||
| 137 | Kernel::ThreadingInit(); | 137 | Kernel::ThreadingInit(); |
| 138 | Kernel::TimersInit(); | 138 | Kernel::TimersInit(); |
| 139 | 139 | ||
| 140 | Process::next_process_id = 0; | ||
| 141 | Object::next_object_id = 0; | 140 | Object::next_object_id = 0; |
| 141 | // TODO(Subv): Start the process ids from 10 for now, as lower PIDs are | ||
| 142 | // reserved for low-level services | ||
| 143 | Process::next_process_id = 10; | ||
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | /// Shutdown the kernel | 146 | /// Shutdown the kernel |
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 11c2ad12d..22cd1049b 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -57,12 +57,6 @@ public: | |||
| 57 | 57 | ||
| 58 | static u32 next_process_id; | 58 | static u32 next_process_id; |
| 59 | 59 | ||
| 60 | /* | ||
| 61 | * Gets the process' id | ||
| 62 | * @returns The process' id | ||
| 63 | */ | ||
| 64 | u32 GetProcessId() const { return process_id; } | ||
| 65 | |||
| 66 | /// Name of the process | 60 | /// Name of the process |
| 67 | std::string name; | 61 | std::string name; |
| 68 | /// Title ID corresponding to the process | 62 | /// Title ID corresponding to the process |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index b5cf554c3..e8159fbdb 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -426,28 +426,28 @@ static ResultCode ReleaseMutex(Handle handle) { | |||
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | /// Get the ID of the specified process | 428 | /// Get the ID of the specified process |
| 429 | static ResultCode GetProcessId(u32* process_id, Handle handle) { | 429 | static ResultCode GetProcessId(u32* process_id, Handle process_handle) { |
| 430 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", handle); | 430 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); |
| 431 | 431 | ||
| 432 | const SharedPtr<Kernel::Process> process = Kernel::g_handle_table.Get<Kernel::Process>(handle); | 432 | const SharedPtr<Kernel::Process> process = Kernel::g_handle_table.Get<Kernel::Process>(process_handle); |
| 433 | if (process == nullptr) | 433 | if (process == nullptr) |
| 434 | return ERR_INVALID_HANDLE; | 434 | return ERR_INVALID_HANDLE; |
| 435 | 435 | ||
| 436 | *process_id = process->GetProcessId(); | 436 | *process_id = process->process_id; |
| 437 | return RESULT_SUCCESS; | 437 | return RESULT_SUCCESS; |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | /// Get the ID of the process that owns the specified thread | 440 | /// Get the ID of the process that owns the specified thread |
| 441 | static ResultCode GetProcessIdOfThread(u32* process_id, Handle handle) { | 441 | static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) { |
| 442 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle); | 442 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); |
| 443 | 443 | ||
| 444 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle); | 444 | const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(thread_handle); |
| 445 | if (thread == nullptr) | 445 | if (thread == nullptr) |
| 446 | return ERR_INVALID_HANDLE; | 446 | return ERR_INVALID_HANDLE; |
| 447 | 447 | ||
| 448 | const SharedPtr<Kernel::Process> process = thread->owner_process; | 448 | const SharedPtr<Kernel::Process> process = thread->owner_process; |
| 449 | if (process == nullptr) | 449 | |
| 450 | return ERR_INVALID_HANDLE; | 450 | ASSERT_MSG(process != nullptr, "Invalid parent process for thread=0x%08X", thread_handle); |
| 451 | 451 | ||
| 452 | *process_id = process->process_id; | 452 | *process_id = process->process_id; |
| 453 | return RESULT_SUCCESS; | 453 | return RESULT_SUCCESS; |