mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 11:03:04 +00:00
Put ThreadUid in the execution context classes
This commit is contained in:
parent
54bf7507d7
commit
d0fbcced57
10 changed files with 32 additions and 5 deletions
|
@ -71,6 +71,8 @@ namespace ARMeilleure.State
|
||||||
|
|
||||||
public bool IsAarch32 { get; set; }
|
public bool IsAarch32 { get; set; }
|
||||||
|
|
||||||
|
public ulong ThreadUid { get; set; }
|
||||||
|
|
||||||
internal ExecutionMode ExecutionMode
|
internal ExecutionMode ExecutionMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -48,6 +48,13 @@ namespace Ryujinx.Cpu.AppleHv
|
||||||
set => _impl.Fpsr = value;
|
set => _impl.Fpsr = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public ulong ThreadUid
|
||||||
|
{
|
||||||
|
get => _impl.ThreadUid;
|
||||||
|
set => _impl.ThreadUid = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool IsAarch32
|
public bool IsAarch32
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,8 @@ namespace Ryujinx.Cpu.AppleHv
|
||||||
|
|
||||||
public bool IsAarch32 { get; set; }
|
public bool IsAarch32 { get; set; }
|
||||||
|
|
||||||
|
public ulong ThreadUid { get; set; }
|
||||||
|
|
||||||
private readonly ulong[] _x;
|
private readonly ulong[] _x;
|
||||||
private readonly V128[] _v;
|
private readonly V128[] _v;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ namespace Ryujinx.Cpu.AppleHv
|
||||||
// This is only valid while debugging is enabled.
|
// This is only valid while debugging is enabled.
|
||||||
public ulong DebugPc { get; set; }
|
public ulong DebugPc { get; set; }
|
||||||
|
|
||||||
|
public ulong ThreadUid { get; set; }
|
||||||
|
|
||||||
static HvExecutionContextVcpu()
|
static HvExecutionContextVcpu()
|
||||||
{
|
{
|
||||||
// .NET does not support passing vectors by value, so we need to pass a pointer and use a native
|
// .NET does not support passing vectors by value, so we need to pass a pointer and use a native
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.Cpu.AppleHv
|
||||||
|
|
||||||
uint Fpcr { get; set; }
|
uint Fpcr { get; set; }
|
||||||
uint Fpsr { get; set; }
|
uint Fpsr { get; set; }
|
||||||
|
ulong ThreadUid { get; set; }
|
||||||
ulong GetX(int index);
|
ulong GetX(int index);
|
||||||
void SetX(int index, ulong value);
|
void SetX(int index, ulong value);
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,11 @@ namespace Ryujinx.Cpu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsAarch32 { get; set; }
|
bool IsAarch32 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thread UID.
|
||||||
|
/// </summary>
|
||||||
|
public ulong ThreadUid { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates whenever the CPU is still running code.
|
/// Indicates whenever the CPU is still running code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -53,6 +53,13 @@ namespace Ryujinx.Cpu.Jit
|
||||||
set => _impl.IsAarch32 = value;
|
set => _impl.IsAarch32 = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public ulong ThreadUid
|
||||||
|
{
|
||||||
|
get => _impl.ThreadUid;
|
||||||
|
set => _impl.ThreadUid = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool Running => _impl.Running;
|
public bool Running => _impl.Running;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ namespace Ryujinx.HLE.Debugger
|
||||||
private ulong[] GetThreadIds() => Device.System.DebugGetApplicationProcess().DebugGetThreadUids();
|
private ulong[] GetThreadIds() => Device.System.DebugGetApplicationProcess().DebugGetThreadUids();
|
||||||
private Ryujinx.Cpu.IExecutionContext GetThread(ulong threadUid) => Device.System.DebugGetApplicationProcess().DebugGetThreadContext(threadUid);
|
private Ryujinx.Cpu.IExecutionContext GetThread(ulong threadUid) => Device.System.DebugGetApplicationProcess().DebugGetThreadContext(threadUid);
|
||||||
private Ryujinx.Cpu.IExecutionContext[] GetThreads() => GetThreadIds().Select(x => GetThread(x)).ToArray();
|
private Ryujinx.Cpu.IExecutionContext[] GetThreads() => GetThreadIds().Select(x => GetThread(x)).ToArray();
|
||||||
private ulong? GetThreadUid(Ryujinx.Cpu.IExecutionContext thread) => GetThreadIds().Where(x => GetThread(x) == thread).First();
|
|
||||||
private IVirtualMemoryManager GetMemory() => Device.System.DebugGetApplicationProcess().CpuMemory;
|
private IVirtualMemoryManager GetMemory() => Device.System.DebugGetApplicationProcess().CpuMemory;
|
||||||
private void InvalidateCacheRegion(ulong address, ulong size) =>
|
private void InvalidateCacheRegion(ulong address, ulong size) =>
|
||||||
Device.System.DebugGetApplicationProcess().InvalidateCacheRegion(address, size);
|
Device.System.DebugGetApplicationProcess().InvalidateCacheRegion(address, size);
|
||||||
|
@ -394,7 +393,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
{
|
{
|
||||||
if (threadId == 0)
|
if (threadId == 0)
|
||||||
{
|
{
|
||||||
threadId = GetThreadUid(GetThreads().First());
|
threadId = GetThreads().First().ThreadUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (op)
|
switch (op)
|
||||||
|
@ -502,12 +501,12 @@ namespace Ryujinx.HLE.Debugger
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.DebugStep();
|
ctx.DebugStep();
|
||||||
Reply($"T00thread:{GetThreadUid(ctx):x};");
|
Reply($"T00thread:{ctx.ThreadUid:x};");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CommandIsAlive(ulong? threadId)
|
private void CommandIsAlive(ulong? threadId)
|
||||||
{
|
{
|
||||||
if (GetThreads().Any(x => GetThreadUid(x) == threadId))
|
if (GetThreads().Any(x => x.ThreadUid == threadId))
|
||||||
{
|
{
|
||||||
ReplyOK();
|
ReplyOK();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
|
|
||||||
public bool IsAarch32 { get => false; set { } }
|
public bool IsAarch32 { get => false; set { } }
|
||||||
|
|
||||||
|
public ulong ThreadUid { get; set; }
|
||||||
|
|
||||||
public bool Running { get; private set; } = true;
|
public bool Running { get; private set; } = true;
|
||||||
|
|
||||||
private readonly ulong[] _x = new ulong[32];
|
private readonly ulong[] _x = new ulong[32];
|
||||||
|
|
|
@ -204,6 +204,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
||||||
Context.TpidrroEl0 = (long)_tlsAddress;
|
Context.TpidrroEl0 = (long)_tlsAddress;
|
||||||
|
|
||||||
ThreadUid = KernelContext.NewThreadUid();
|
ThreadUid = KernelContext.NewThreadUid();
|
||||||
|
Context.ThreadUid = ThreadUid;
|
||||||
|
|
||||||
HostThread.Name = customThreadStart != null ? $"HLE.OsThread.{ThreadUid}" : $"HLE.GuestThread.{ThreadUid}";
|
HostThread.Name = customThreadStart != null ? $"HLE.OsThread.{ThreadUid}" : $"HLE.GuestThread.{ThreadUid}";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue