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