[HLE/Kernel] Fix SetThreadPriority, allow nano seconds values > int.MaxValue, fix on WaitProcessWideKeyAtomic (althrough looks like it still doesn't work properly

This commit is contained in:
gdkchan 2018-04-19 04:06:23 -03:00
parent 62b2124c03
commit 33ae6e544b
6 changed files with 47 additions and 24 deletions

View file

@ -55,10 +55,10 @@ namespace Ryujinx.Core.OsHle.Kernel
private void SvcWaitProcessWideKeyAtomic(AThreadState ThreadState)
{
long MutexAddress = (long)ThreadState.X0;
long CondVarAddress = (long)ThreadState.X1;
int ThreadHandle = (int)ThreadState.X2;
long Timeout = (long)ThreadState.X3;
long MutexAddress = (long)ThreadState.X0;
long CondVarAddress = (long)ThreadState.X1;
int ThreadHandle = (int)ThreadState.X2;
ulong Timeout = ThreadState.X3;
KThread Thread = Process.HandleTable.GetData<KThread>(ThreadHandle);
@ -69,6 +69,8 @@ namespace Ryujinx.Core.OsHle.Kernel
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
Process.Scheduler.Suspend(Thread.ProcessorId);
MutualExclusion Mutex = GetMutex(MutexAddress);
Mutex.Unlock();
@ -82,6 +84,8 @@ namespace Ryujinx.Core.OsHle.Kernel
Mutex.WaitForLock(Thread);
Process.Scheduler.Resume(Thread);
ThreadState.X0 = 0;
}