diff options
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/svc/svc_info.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_process.cpp | 15 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index a66d633f8..26eb1ce92 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp @@ -174,9 +174,15 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle R_SUCCEED(); case InfoType::InitialProcessIdRange: - LOG_WARNING(Kernel_SVC, - "(STUBBED) Attempted to query privileged process id bounds, returned 0"); - *result = 0; + R_UNLESS(handle == 0, ResultInvalidHandle); + R_UNLESS(info_sub_id <= 1, ResultInvalidCombination); + + // Return the valid range for initial process IDs + if (info_sub_id == 0) { + *result = 1; // Minimum initial process ID + } else { + *result = 0x50; // Maximum initial process ID + } R_SUCCEED(); case InfoType::ThreadTickCount: { diff --git a/src/core/hle/kernel/svc/svc_process.cpp b/src/core/hle/kernel/svc/svc_process.cpp index 5c3e8829f..acd1864da 100644 --- a/src/core/hle/kernel/svc/svc_process.cpp +++ b/src/core/hle/kernel/svc/svc_process.cpp @@ -12,10 +12,19 @@ void ExitProcess(Core::System& system) { auto* current_process = GetCurrentProcessPointer(system.Kernel()); LOG_INFO(Kernel_SVC, "Process {} exiting", current_process->GetProcessId()); - ASSERT_MSG(current_process->GetState() == KProcess::State::Running, - "Process has already exited"); - system.Exit(); + // Check if process is in a valid state for exit + if (current_process->GetState() != KProcess::State::Running) { + LOG_WARNING(Kernel_SVC, "Process {} already exiting or in invalid state", current_process->GetProcessId()); + return; + } + + // Ensure clean shutdown + try { + system.Exit(); + } catch (const std::exception& e) { + LOG_ERROR(Kernel_SVC, "Error during process exit: {}", e.what()); + } } /// Gets the ID of the specified process or a specified thread's owning process. |
