aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/OsHle/Process.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Core/OsHle/Process.cs')
-rw-r--r--Ryujinx.Core/OsHle/Process.cs39
1 files changed, 35 insertions, 4 deletions
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<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++)