kernel: A bit of refactoring and fix GetThreadContext3 correctness (#3042)

* Start refactoring kernel a bit and import some changes from kernel decoupling PR

* kernel: Put output always at the start in Syscall functions

* kernel: Rewrite GetThreadContext3 to use a structure and to be accurate

* kernel: make KernelTransfer use generic types and simplify

* Fix some warning and do not use getters on MemoryInfo

* Address gdkchan's comment

* GetThreadContext3: use correct pause flag
This commit is contained in:
Mary 2022-01-29 22:18:03 +01:00 committed by GitHub
parent c52158b733
commit 20ce37dee6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 386 additions and 321 deletions

View file

@ -11,8 +11,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
public byte[] SvcAccessMask { get; private set; }
public byte[] IrqAccessMask { get; private set; }
public long AllowedCpuCoresMask { get; private set; }
public long AllowedThreadPriosMask { get; private set; }
public ulong AllowedCpuCoresMask { get; private set; }
public ulong AllowedThreadPriosMask { get; private set; }
public int DebuggingFlags { get; private set; }
public int HandleTableSize { get; private set; }
@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
public KernelResult InitializeForKernel(ReadOnlySpan<int> capabilities, KPageTableBase memoryManager)
{
AllowedCpuCoresMask = 0xf;
AllowedThreadPriosMask = -1;
AllowedThreadPriosMask = ulong.MaxValue;
DebuggingFlags &= ~3;
KernelReleaseVersion = KProcess.KernelVersionPacked;
@ -303,16 +303,16 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
return KernelResult.Success;
}
private static long GetMaskFromMinMax(int min, int max)
private static ulong GetMaskFromMinMax(int min, int max)
{
int range = max - min + 1;
if (range == 64)
{
return -1L;
return ulong.MaxValue;
}
long mask = (1L << range) - 1;
ulong mask = (1UL << range) - 1;
return mask << min;
}