summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/kernel.cpp4
-rw-r--r--src/core/hle/kernel/process.h6
-rw-r--r--src/core/hle/svc.cpp18
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() {
Kernel::ThreadingInit();
Kernel::TimersInit();
- Process::next_process_id = 0;
Object::next_object_id = 0;
+ // TODO(Subv): Start the process ids from 10 for now, as lower PIDs are
+ // reserved for low-level services
+ Process::next_process_id = 10;
}
/// 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:
static u32 next_process_id;
- /*
- * Gets the process' id
- * @returns The process' id
- */
- u32 GetProcessId() const { return process_id; }
-
/// Name of the process
std::string name;
/// 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) {
}
/// Get the ID of the specified process
-static ResultCode GetProcessId(u32* process_id, Handle handle) {
- LOG_TRACE(Kernel_SVC, "called process=0x%08X", handle);
+static ResultCode GetProcessId(u32* process_id, Handle process_handle) {
+ LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle);
- const SharedPtr<Kernel::Process> process = Kernel::g_handle_table.Get<Kernel::Process>(handle);
+ const SharedPtr<Kernel::Process> process = Kernel::g_handle_table.Get<Kernel::Process>(process_handle);
if (process == nullptr)
return ERR_INVALID_HANDLE;
- *process_id = process->GetProcessId();
+ *process_id = process->process_id;
return RESULT_SUCCESS;
}
/// Get the ID of the process that owns the specified thread
-static ResultCode GetProcessIdOfThread(u32* process_id, Handle handle) {
- LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle);
+static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
+ LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle);
- const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(handle);
+ const SharedPtr<Kernel::Thread> thread = Kernel::g_handle_table.Get<Kernel::Thread>(thread_handle);
if (thread == nullptr)
return ERR_INVALID_HANDLE;
const SharedPtr<Kernel::Process> process = thread->owner_process;
- if (process == nullptr)
- return ERR_INVALID_HANDLE;
+
+ ASSERT_MSG(process != nullptr, "Invalid parent process for thread=0x%08X", thread_handle);
*process_id = process->process_id;
return RESULT_SUCCESS;