Add 32 bits support to HleProcessDebugger
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
This commit is contained in:
parent
80707f9311
commit
6ab170b55a
1 changed files with 53 additions and 16 deletions
|
@ -72,14 +72,35 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: ARM32.
|
|
||||||
long framePointer = (long)context.GetX(29);
|
|
||||||
|
|
||||||
trace.AppendLine($"Process: {_owner.Name}, PID: {_owner.Pid}");
|
trace.AppendLine($"Process: {_owner.Name}, PID: {_owner.Pid}");
|
||||||
|
|
||||||
|
if (context.IsAarch32)
|
||||||
|
{
|
||||||
|
long framePointer = (long)context.GetX(11);
|
||||||
|
|
||||||
while (framePointer != 0)
|
while (framePointer != 0)
|
||||||
{
|
{
|
||||||
if ((framePointer & 7) != 0 ||
|
if ((framePointer & 7) != 0 ||
|
||||||
|
!_owner.CpuMemory.IsMapped(framePointer) ||
|
||||||
|
!_owner.CpuMemory.IsMapped(framePointer + 4))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: This is the return address, we need to subtract one instruction
|
||||||
|
// worth of bytes to get the branch instruction address.
|
||||||
|
AppendTrace(_owner.CpuMemory.ReadInt32(framePointer + 4) - 4);
|
||||||
|
|
||||||
|
framePointer = _owner.CpuMemory.ReadInt32(framePointer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
long framePointer = (long)context.GetX(29);
|
||||||
|
|
||||||
|
while (framePointer != 0)
|
||||||
|
{
|
||||||
|
if ((framePointer & 15) != 0 ||
|
||||||
!_owner.CpuMemory.IsMapped(framePointer) ||
|
!_owner.CpuMemory.IsMapped(framePointer) ||
|
||||||
!_owner.CpuMemory.IsMapped(framePointer + 8))
|
!_owner.CpuMemory.IsMapped(framePointer + 8))
|
||||||
{
|
{
|
||||||
|
@ -92,6 +113,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
|
|
||||||
framePointer = _owner.CpuMemory.ReadInt64(framePointer);
|
framePointer = _owner.CpuMemory.ReadInt64(framePointer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return trace.ToString();
|
return trace.ToString();
|
||||||
}
|
}
|
||||||
|
@ -242,13 +264,28 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
long ehHdrEndOffset = memory.ReadInt32(mod0Offset + 0x14) + mod0Offset;
|
long ehHdrEndOffset = memory.ReadInt32(mod0Offset + 0x14) + mod0Offset;
|
||||||
long modObjOffset = memory.ReadInt32(mod0Offset + 0x18) + mod0Offset;
|
long modObjOffset = memory.ReadInt32(mod0Offset + 0x18) + mod0Offset;
|
||||||
|
|
||||||
// TODO: Elf32.
|
bool isAArch32 = memory.ReadUInt64(dynamicOffset) > 0xFFFFFFFF || memory.ReadUInt64(dynamicOffset + 0x10) > 0xFFFFFFFF;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
long tagVal = memory.ReadInt64(dynamicOffset + 0);
|
long tagVal;
|
||||||
long value = memory.ReadInt64(dynamicOffset + 8);
|
long value;
|
||||||
|
|
||||||
|
if (isAArch32)
|
||||||
|
{
|
||||||
|
tagVal = memory.ReadInt32(dynamicOffset + 0);
|
||||||
|
value = memory.ReadInt32(dynamicOffset + 4);
|
||||||
|
|
||||||
|
dynamicOffset += 0x8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tagVal = memory.ReadInt64(dynamicOffset + 0);
|
||||||
|
value = memory.ReadInt64(dynamicOffset + 8);
|
||||||
|
|
||||||
dynamicOffset += 0x10;
|
dynamicOffset += 0x10;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ElfDynamicTag tag = (ElfDynamicTag)tagVal;
|
ElfDynamicTag tag = (ElfDynamicTag)tagVal;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue