2020-05-03 18:54:50 -04: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 15:07:42 -05:00
|
|
|
|
memory.UnmapEvent += UnmapHandler;
|
2020-05-03 18:54:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-16 15:07:42 -05:00
|
|
|
|
private void UnmapHandler(ulong address, ulong size)
|
|
|
|
|
{
|
|
|
|
|
_translator.InvalidateJitCacheRegion(address, size);
|
|
|
|
|
}
|
2020-05-03 18:54:50 -04:00
|
|
|
|
|
2020-12-16 15:07:42 -05:00
|
|
|
|
public static ExecutionContext CreateExecutionContext()
|
|
|
|
|
{
|
|
|
|
|
return new ExecutionContext(new JitMemoryAllocator());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Execute(ExecutionContext context, ulong address)
|
|
|
|
|
{
|
|
|
|
|
_translator.Execute(context, address);
|
|
|
|
|
}
|
2020-05-03 18:54:50 -04:00
|
|
|
|
}
|
|
|
|
|
}
|