Archived
1
0
Fork 0
forked from Mirror/Ryujinx

Fix SvcGetThreadId

This commit is contained in:
gdkchan 2018-04-04 16:07:44 -03:00
parent 0ac4681fa0
commit e0c3d9c8df

View file

@ -1,6 +1,8 @@
using ChocolArm64.State;
using Ryujinx.Core.OsHle.Handles;
using static Ryujinx.Core.OsHle.ErrorCode;
namespace Ryujinx.Core.OsHle.Svc
{
partial class SvcHandler
@ -61,11 +63,11 @@ namespace Ryujinx.Core.OsHle.Svc
}
private void SvcSleepThread(AThreadState ThreadState)
{
{
ulong NanoSecs = ThreadState.X0;
KThread CurrThread = Process.GetThread(ThreadState.Tpidr);
if (NanoSecs == 0)
{
Process.Scheduler.Yield(CurrThread);
@ -117,7 +119,7 @@ namespace Ryujinx.Core.OsHle.Svc
private void SvcGetThreadId(AThreadState ThreadState)
{
int Handle = (int)ThreadState.X0;
int Handle = (int)ThreadState.X1;
KThread Thread = Process.HandleTable.GetData<KThread>(Handle);
@ -126,8 +128,12 @@ namespace Ryujinx.Core.OsHle.Svc
ThreadState.X0 = 0;
ThreadState.X1 = (ulong)Thread.ThreadId;
}
else
{
Logging.Warn($"Tried to GetThreadId on invalid thread handle 0x{Handle:x8}!");
//TODO: Error codes.
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
}
}
}