Enable ARM32 support and handle undefined instructions
This commit is contained in:
parent
ead8ca83d3
commit
b55dce1765
5 changed files with 17 additions and 11 deletions
|
@ -225,11 +225,6 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
}
|
||||
|
||||
if (!metaData.Is64Bits)
|
||||
{
|
||||
throw new NotImplementedException("32-bit titles are unsupported!");
|
||||
}
|
||||
|
||||
CurrentTitle = metaData.Aci0.TitleId.ToString("x16");
|
||||
|
||||
LoadNso("rtld");
|
||||
|
@ -543,11 +538,6 @@ namespace Ryujinx.HLE.HOS
|
|||
CurrentTitle = metaData.Aci0.TitleId.ToString("x16");
|
||||
}
|
||||
|
||||
if (!metaData.Is64Bits)
|
||||
{
|
||||
throw new NotImplementedException("32-bit titles are not supported!");
|
||||
}
|
||||
|
||||
LoadNso("rtld");
|
||||
LoadNso("main");
|
||||
LoadNso("subsdk");
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: ARM32.
|
||||
long framePointer = (long)threadState.X29;
|
||||
|
||||
while (framePointer != 0)
|
||||
|
@ -245,6 +246,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
long ehHdrEndOffset = memory.ReadInt32(mod0Offset + 0x14) + mod0Offset;
|
||||
long modObjOffset = memory.ReadInt32(mod0Offset + 0x18) + mod0Offset;
|
||||
|
||||
//TODO: Elf32.
|
||||
while (true)
|
||||
{
|
||||
long tagVal = memory.ReadInt64(dynamicOffset + 0);
|
||||
|
|
|
@ -3,6 +3,7 @@ using ChocolArm64.Events;
|
|||
using ChocolArm64.Memory;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.Exceptions;
|
||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
using Ryujinx.HLE.HOS.Kernel.SupervisorCall;
|
||||
|
@ -797,6 +798,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
{
|
||||
context.ThreadState.Interrupt += InterruptHandler;
|
||||
context.ThreadState.SvcCall += _svcHandler.SvcCall;
|
||||
context.ThreadState.Undefined += UndefinedInstructionHandler;
|
||||
}
|
||||
|
||||
private void InterruptHandler(object sender, EventArgs e)
|
||||
|
@ -1021,5 +1023,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
{
|
||||
Logger.PrintInfo(LogClass.Cpu, $"Executing at 0x{e.Position:X16}.");
|
||||
}
|
||||
|
||||
private void UndefinedInstructionHandler(object sender, InstUndefinedEventArgs e)
|
||||
{
|
||||
throw new UndefinedInstructionException(e.Position, e.RawOpCode);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -152,6 +152,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
|
||||
Context = new CpuThread(owner.Translator, owner.CpuMemory, (long)entrypoint);
|
||||
|
||||
Context.ThreadState.IsAarch32 = (Owner.MmuFlags & 1) == 0;
|
||||
|
||||
Context.ThreadState.X0 = argsPtr;
|
||||
Context.ThreadState.X31 = stackTop;
|
||||
|
||||
|
|
|
@ -125,9 +125,14 @@ namespace Ryujinx.HLE.HOS
|
|||
IExecutable[] staticObjects,
|
||||
byte[] arguments = null)
|
||||
{
|
||||
if (!metaData.Is64Bits)
|
||||
{
|
||||
Logger.PrintWarning(LogClass.Loader, "32-bits application detected!");
|
||||
}
|
||||
|
||||
ulong argsStart = 0;
|
||||
int argsSize = 0;
|
||||
ulong codeStart = 0x8000000;
|
||||
ulong codeStart = metaData.Is64Bits ? 0x8000000UL : 0x200000UL;
|
||||
int codeSize = 0;
|
||||
|
||||
ulong[] nsoBase = new ulong[staticObjects.Length];
|
||||
|
|
Loading…
Add table
Reference in a new issue