aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs')
-rw-r--r--Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs43
1 files changed, 42 insertions, 1 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs
index 6525628f..7961f124 100644
--- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs
+++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs
@@ -17,9 +17,41 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
ExitProcess();
}
+ public KernelResult TerminateProcess64(int handle)
+ {
+ return TerminateProcess(handle);
+ }
+
+ private KernelResult TerminateProcess(int handle)
+ {
+ KProcess process = _process.HandleTable.GetObject<KProcess>(handle);
+
+ KernelResult result;
+
+ if (process != null)
+ {
+ if (process == _system.Scheduler.GetCurrentProcess())
+ {
+ result = KernelResult.Success;
+ process.DecrementToZeroWhileTerminatingCurrent();
+ }
+ else
+ {
+ result = process.Terminate();
+ process.DecrementReferenceCount();
+ }
+ }
+ else
+ {
+ result = KernelResult.InvalidHandle;
+ }
+
+ return result;
+ }
+
private void ExitProcess()
{
- _system.Scheduler.GetCurrentProcess().Terminate();
+ _system.Scheduler.GetCurrentProcess().TerminateCurrentProcess();
}
public KernelResult SignalEvent64(int handle)
@@ -184,6 +216,15 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
{
currentThread.PrintGuestStackTrace();
+ // As the process is exiting, this is probably caused by emulation termination.
+ if (currentThread.Owner.State == ProcessState.Exiting)
+ {
+ return;
+ }
+
+ // TODO: Debug events.
+ currentThread.Owner.TerminateCurrentProcess();
+
throw new GuestBrokeExecutionException();
}
else