2020-05-04 00:54:50 +02:00
|
|
|
|
using ARMeilleure.State;
|
|
|
|
|
using ARMeilleure.Translation;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Cpu
|
|
|
|
|
{
|
|
|
|
|
public class CpuContext
|
|
|
|
|
{
|
|
|
|
|
private readonly Translator _translator;
|
|
|
|
|
|
|
|
|
|
public CpuContext(MemoryManager memory)
|
|
|
|
|
{
|
|
|
|
|
_translator = new Translator(new JitMemoryAllocator(), memory);
|
2020-12-16 21:07:42 +01:00
|
|
|
|
memory.UnmapEvent += UnmapHandler;
|
2020-05-04 00:54:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-16 21:07:42 +01:00
|
|
|
|
private void UnmapHandler(ulong address, ulong size)
|
|
|
|
|
{
|
|
|
|
|
_translator.InvalidateJitCacheRegion(address, size);
|
|
|
|
|
}
|
2020-05-04 00:54:50 +02:00
|
|
|
|
|
2020-12-16 21:07:42 +01:00
|
|
|
|
public static ExecutionContext CreateExecutionContext()
|
|
|
|
|
{
|
|
|
|
|
return new ExecutionContext(new JitMemoryAllocator());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Execute(ExecutionContext context, ulong address)
|
|
|
|
|
{
|
|
|
|
|
_translator.Execute(context, address);
|
|
|
|
|
}
|
2020-05-04 00:54:50 +02:00
|
|
|
|
}
|
|
|
|
|
}
|