Added initial support for function names from symbol table on the cpu with tracing, fix wrong ImageEnd on executables with MOD0, fix issue on the CPU on input elimination for instruction with more than one register store

This commit is contained in:
gdkchan 2018-02-25 22:14:58 -03:00
parent e174100474
commit 950011c90f
20 changed files with 217 additions and 93 deletions

View file

@ -1,6 +1,6 @@
using ChocolArm64;
using ChocolArm64.Events;
using ChocolArm64.Memory;
using ChocolArm64.State;
using Ryujinx.Core.Loaders;
using Ryujinx.Core.Loaders.Executables;
using Ryujinx.Core.OsHle.Exceptions;
@ -24,6 +24,8 @@ namespace Ryujinx.Core.OsHle
private Switch Ns;
private ATranslator Translator;
public int ProcessId { get; private set; }
public AMemory Memory { get; private set; }
@ -171,7 +173,7 @@ namespace Ryujinx.Core.OsHle
ThreadPrio = ThreadPriority.Lowest;
}
AThread Thread = new AThread(Memory, ThreadPrio, EntryPoint);
AThread Thread = new AThread(GetTranslator(), Memory, ThreadPrio, EntryPoint);
HThread ThreadHnd = new HThread(Thread, ProcessorId, Priority);
@ -201,16 +203,45 @@ namespace Ryujinx.Core.OsHle
return Handle;
}
private void BreakHandler(object sender, AInstExceptEventArgs e)
private void BreakHandler(object sender, AInstExceptionEventArgs e)
{
throw new GuestBrokeExecutionException();
}
private void UndefinedHandler(object sender, AInstUndEventArgs e)
private void UndefinedHandler(object sender, AInstUndefinedEventArgs e)
{
throw new UndefinedInstructionException(e.Position, e.RawOpCode);
}
private ATranslator GetTranslator()
{
if (Translator == null)
{
Dictionary<long, string> SymbolTable = new Dictionary<long, string>();
foreach (Executable Exe in Executables)
{
foreach (KeyValuePair<long, string> KV in Exe.SymbolTable)
{
SymbolTable.Add(Exe.ImageBase + KV.Key, KV.Value);
}
}
Translator = new ATranslator(SymbolTable);
Translator.CpuTrace += CpuTraceHandler;
}
return Translator;
}
private void CpuTraceHandler(object sender, ACpuTraceEventArgs e)
{
Logging.Info($"Executing at 0x{e.Position:x16} {e.SubName}");
}
private int GetFreeTlsSlot(AThread Thread)
{
for (int Index = 1; Index < TotalTlsSlots; Index++)