From ef92c9c5e46b4ee8efb475dbdf9bd7c1a04ba0ad Mon Sep 17 00:00:00 2001 From: merry Date: Sun, 13 Feb 2022 14:36:47 +0000 Subject: [PATCH] threadUid is now ulong --- ARMeilleure/State/ExecutionContext.cs | 2 ++ Ryujinx.HLE/Debugger/Debugger.cs | 16 ++++++++-------- Ryujinx.HLE/Debugger/IDebuggableProcess.cs | 4 ++-- Ryujinx.HLE/Debugger/StringStream.cs | 4 ++-- Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs | 4 ++-- Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs | 1 + 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/ARMeilleure/State/ExecutionContext.cs b/ARMeilleure/State/ExecutionContext.cs index f77f2b2a3..5ccf1b26f 100644 --- a/ARMeilleure/State/ExecutionContext.cs +++ b/ARMeilleure/State/ExecutionContext.cs @@ -57,6 +57,8 @@ namespace ARMeilleure.State public bool IsAarch32 { get; set; } + public ulong ThreadUid { get; set; } + internal ExecutionMode ExecutionMode { get diff --git a/Ryujinx.HLE/Debugger/Debugger.cs b/Ryujinx.HLE/Debugger/Debugger.cs index 8df74651f..0e981cd92 100644 --- a/Ryujinx.HLE/Debugger/Debugger.cs +++ b/Ryujinx.HLE/Debugger/Debugger.cs @@ -25,8 +25,8 @@ namespace Ryujinx.HLE.Debugger private Thread SocketThread; private Thread HandlerThread; - private long? cThread; - private long? gThread; + private ulong? cThread; + private ulong? gThread; public Debugger(Switch device, ushort port) { @@ -42,9 +42,9 @@ namespace Ryujinx.HLE.Debugger } private void HaltApplication() => Device.System.DebugGetApplicationProcess().DebugStopAllThreads(); - private long[] GetThreadIds() => Device.System.DebugGetApplicationProcess().DebugGetThreadUids(); + private ulong[] GetThreadIds() => Device.System.DebugGetApplicationProcess().DebugGetThreadUids(); - private ARMeilleure.State.ExecutionContext GetThread(long threadUid) => + private ARMeilleure.State.ExecutionContext GetThread(ulong threadUid) => Device.System.DebugGetApplicationProcess().DebugGetThreadContext(threadUid); private ARMeilleure.State.ExecutionContext[] GetThreads() => GetThreadIds().Select(GetThread).ToArray(); private IVirtualMemoryManager GetMemory() => Device.System.DebugGetApplicationProcess().CpuMemory; @@ -188,7 +188,7 @@ namespace Ryujinx.HLE.Debugger case 'H': { char op = ss.ReadChar(); - long? threadId = ss.ReadRemainingAsThreadUid(); + ulong? threadId = ss.ReadRemainingAsThreadUid(); CommandSetThread(op, threadId); break; } @@ -303,7 +303,7 @@ namespace Ryujinx.HLE.Debugger break; case 'T': { - long? threadId = ss.ReadRemainingAsThreadUid(); + ulong? threadId = ss.ReadRemainingAsThreadUid(); CommandIsAlive(threadId); break; } @@ -391,7 +391,7 @@ namespace Ryujinx.HLE.Debugger } } - void CommandSetThread(char op, long? threadId) + void CommandSetThread(char op, ulong? threadId) { if (threadId == 0) { @@ -506,7 +506,7 @@ namespace Ryujinx.HLE.Debugger Reply($"T00thread:{ctx.ThreadUid:x};"); } - private void CommandIsAlive(long? threadId) + private void CommandIsAlive(ulong? threadId) { if (GetThreads().Any(x => x.ThreadUid == threadId)) { diff --git a/Ryujinx.HLE/Debugger/IDebuggableProcess.cs b/Ryujinx.HLE/Debugger/IDebuggableProcess.cs index 719888da4..56c37689a 100644 --- a/Ryujinx.HLE/Debugger/IDebuggableProcess.cs +++ b/Ryujinx.HLE/Debugger/IDebuggableProcess.cs @@ -5,8 +5,8 @@ namespace Ryujinx.HLE.Debugger public interface IDebuggableProcess { void DebugStopAllThreads(); - long[] DebugGetThreadUids(); - ARMeilleure.State.ExecutionContext DebugGetThreadContext(long threadUid); + ulong[] DebugGetThreadUids(); + ARMeilleure.State.ExecutionContext DebugGetThreadContext(ulong threadUid); IVirtualMemoryManager CpuMemory { get; } void InvalidateCacheRegion(ulong address, ulong size); } diff --git a/Ryujinx.HLE/Debugger/StringStream.cs b/Ryujinx.HLE/Debugger/StringStream.cs index 4616bf964..5542aff01 100644 --- a/Ryujinx.HLE/Debugger/StringStream.cs +++ b/Ryujinx.HLE/Debugger/StringStream.cs @@ -75,10 +75,10 @@ namespace Ryujinx.HLE.Debugger return result; } - public long? ReadRemainingAsThreadUid() + public ulong? ReadRemainingAsThreadUid() { string s = ReadRemaining(); - return s == "-1" ? null : long.Parse(s, NumberStyles.HexNumber); + return s == "-1" ? null : ulong.Parse(s, NumberStyles.HexNumber); } public bool ConsumePrefix(string prefix) diff --git a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs index 09a0136be..7bab3f22d 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs @@ -1213,7 +1213,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process } } - public long[] DebugGetThreadUids() + public ulong[] DebugGetThreadUids() { lock (_parent._threadingLock) { @@ -1221,7 +1221,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process } } - public ARMeilleure.State.ExecutionContext DebugGetThreadContext(long threadUid) + public ARMeilleure.State.ExecutionContext DebugGetThreadContext(ulong threadUid) { lock (_parent._threadingLock) { diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs b/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs index ee701a690..21fc6f9bf 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs @@ -212,6 +212,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading Context.Tpidr = (long)_tlsAddress; ThreadUid = KernelContext.NewThreadUid(); + Context.ThreadUid = ThreadUid; HostThread.Name = customThreadStart != null ? $"HLE.OsThread.{ThreadUid}" : $"HLE.GuestThread.{ThreadUid}";