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