misc: Make PID unsigned long instead of long (#3043)
This commit is contained in:
parent
86b37d0ff7
commit
6dffe0fad4
43 changed files with 99 additions and 100 deletions
|
@ -42,14 +42,14 @@ namespace Ryujinx.HLE.HOS.Kernel
|
|||
public KSynchronization Synchronization { get; }
|
||||
public KContextIdManager ContextIdManager { get; }
|
||||
|
||||
public ConcurrentDictionary<long, KProcess> Processes { get; }
|
||||
public ConcurrentDictionary<ulong, KProcess> Processes { get; }
|
||||
public ConcurrentDictionary<string, KAutoObject> AutoObjectNames { get; }
|
||||
|
||||
public bool ThreadReselectionRequested { get; set; }
|
||||
|
||||
private long _kipId;
|
||||
private long _processId;
|
||||
private long _threadUid;
|
||||
private ulong _kipId;
|
||||
private ulong _processId;
|
||||
private ulong _threadUid;
|
||||
|
||||
public KernelContext(
|
||||
Switch device,
|
||||
|
@ -98,7 +98,7 @@ namespace Ryujinx.HLE.HOS.Kernel
|
|||
|
||||
KernelInitialized = true;
|
||||
|
||||
Processes = new ConcurrentDictionary<long, KProcess>();
|
||||
Processes = new ConcurrentDictionary<ulong, KProcess>();
|
||||
AutoObjectNames = new ConcurrentDictionary<string, KAutoObject>();
|
||||
|
||||
_kipId = KernelConstants.InitialKipId;
|
||||
|
@ -115,17 +115,17 @@ namespace Ryujinx.HLE.HOS.Kernel
|
|||
new Thread(PreemptionThreadStart) { Name = "HLE.PreemptionThread" }.Start();
|
||||
}
|
||||
|
||||
public long NewThreadUid()
|
||||
public ulong NewThreadUid()
|
||||
{
|
||||
return Interlocked.Increment(ref _threadUid) - 1;
|
||||
}
|
||||
|
||||
public long NewKipId()
|
||||
public ulong NewKipId()
|
||||
{
|
||||
return Interlocked.Increment(ref _kipId) - 1;
|
||||
}
|
||||
|
||||
public long NewProcessId()
|
||||
public ulong NewProcessId()
|
||||
{
|
||||
return Interlocked.Increment(ref _processId) - 1;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||
{
|
||||
private readonly SharedMemoryStorage _storage;
|
||||
|
||||
private readonly long _ownerPid;
|
||||
private readonly ulong _ownerPid;
|
||||
|
||||
private readonly KMemoryPermission _ownerPermission;
|
||||
private readonly KMemoryPermission _userPermission;
|
||||
|
@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||
public KSharedMemory(
|
||||
KernelContext context,
|
||||
SharedMemoryStorage storage,
|
||||
long ownerPid,
|
||||
ulong ownerPid,
|
||||
KMemoryPermission ownerPermission,
|
||||
KMemoryPermission userPermission) : base(context)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
{
|
||||
interface IProcessContextFactory
|
||||
{
|
||||
IProcessContext Create(KernelContext context, long pid, ulong addressSpaceSize, InvalidAccessHandler invalidAccessHandler, bool for64Bit);
|
||||
IProcessContext Create(KernelContext context, ulong pid, ulong addressSpaceSize, InvalidAccessHandler invalidAccessHandler, bool for64Bit);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
public ulong TitleId { get; private set; }
|
||||
public bool IsApplication { get; private set; }
|
||||
public long Pid { get; private set; }
|
||||
public ulong Pid { get; private set; }
|
||||
|
||||
private long _creationTimestamp;
|
||||
private ulong _entrypoint;
|
||||
|
@ -131,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
Pid = KernelContext.NewKipId();
|
||||
|
||||
if (Pid == 0 || (ulong)Pid >= KernelConstants.InitialProcessId)
|
||||
if (Pid == 0 || Pid >= KernelConstants.InitialProcessId)
|
||||
{
|
||||
throw new InvalidOperationException($"Invalid KIP Id {Pid}.");
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
Pid = KernelContext.NewProcessId();
|
||||
|
||||
if (Pid == -1 || (ulong)Pid < KernelConstants.InitialProcessId)
|
||||
if (Pid == ulong.MaxValue || Pid < KernelConstants.InitialProcessId)
|
||||
{
|
||||
throw new InvalidOperationException($"Invalid Process Id {Pid}.");
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
{
|
||||
class ProcessContextFactory : IProcessContextFactory
|
||||
{
|
||||
public IProcessContext Create(KernelContext context, long pid, ulong addressSpaceSize, InvalidAccessHandler invalidAccessHandler, bool for64Bit)
|
||||
public IProcessContext Create(KernelContext context, ulong pid, ulong addressSpaceSize, InvalidAccessHandler invalidAccessHandler, bool for64Bit)
|
||||
{
|
||||
return new ProcessContext(new AddressSpaceManager(addressSpaceSize));
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
// Process
|
||||
|
||||
public KernelResult GetProcessId(out long pid, int handle)
|
||||
public KernelResult GetProcessId(out ulong pid, int handle)
|
||||
{
|
||||
KProcess currentProcess = KernelStatic.GetCurrentProcess();
|
||||
|
||||
|
@ -2280,7 +2280,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
return KernelStatic.GetCurrentThread().CurrentCore;
|
||||
}
|
||||
|
||||
public KernelResult GetThreadId(out long threadUid, int handle)
|
||||
public KernelResult GetThreadId(out ulong threadUid, int handle)
|
||||
{
|
||||
KProcess process = KernelStatic.GetCurrentProcess();
|
||||
|
||||
|
|
|
@ -235,12 +235,12 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
resultHigh = (uint)(result >> 32);
|
||||
}
|
||||
|
||||
public KernelResult GetProcessId32([R(1)] int handle, [R(1)] out int pidLow, [R(2)] out int pidHigh)
|
||||
public KernelResult GetProcessId32([R(1)] int handle, [R(1)] out uint pidLow, [R(2)] out uint pidHigh)
|
||||
{
|
||||
KernelResult result = _syscall.GetProcessId(out long pid, handle);
|
||||
KernelResult result = _syscall.GetProcessId(out ulong pid, handle);
|
||||
|
||||
pidLow = (int)(pid & uint.MaxValue);
|
||||
pidHigh = (int)(pid >> 32);
|
||||
pidLow = (uint)(pid & uint.MaxValue);
|
||||
pidHigh = (uint)(pid >> 32);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
public KernelResult GetThreadId32([R(1)] int handle, [R(1)] out uint threadUidLow, [R(2)] out uint threadUidHigh)
|
||||
{
|
||||
long threadUid;
|
||||
ulong threadUid;
|
||||
|
||||
KernelResult result = _syscall.GetThreadId(out threadUid, handle);
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
return _syscall.GetSystemTick();
|
||||
}
|
||||
|
||||
public KernelResult GetProcessId64([R(1)] int handle, [R(1)] out long pid)
|
||||
public KernelResult GetProcessId64([R(1)] int handle, [R(1)] out ulong pid)
|
||||
{
|
||||
return _syscall.GetProcessId(out pid, handle);
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
return _syscall.GetCurrentProcessorNumber();
|
||||
}
|
||||
|
||||
public KernelResult GetThreadId64([R(1)] int handle, [R(1)] out long threadUid)
|
||||
public KernelResult GetThreadId64([R(1)] int handle, [R(1)] out ulong threadUid)
|
||||
{
|
||||
return _syscall.GetThreadId(out threadUid, handle);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
public int DynamicPriority { get; set; }
|
||||
public ulong AffinityMask { get; set; }
|
||||
|
||||
public long ThreadUid { get; private set; }
|
||||
public ulong ThreadUid { get; private set; }
|
||||
|
||||
private long _totalTimeRunning;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue