From 950011c90fe28fe9edd8ebe0d0a771f6adcff7a1 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 25 Feb 2018 22:14:58 -0300 Subject: 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 --- Ryujinx.Core/OsHle/Process.cs | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'Ryujinx.Core/OsHle/Process.cs') diff --git a/Ryujinx.Core/OsHle/Process.cs b/Ryujinx.Core/OsHle/Process.cs index 3e265ed3..60e71ee9 100644 --- a/Ryujinx.Core/OsHle/Process.cs +++ b/Ryujinx.Core/OsHle/Process.cs @@ -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 SymbolTable = new Dictionary(); + + foreach (Executable Exe in Executables) + { + foreach (KeyValuePair 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++) -- cgit v1.2.3