CpuContext.cs 807 B

12345678910111213141516171819202122232425262728293031
  1. using ARMeilleure.State;
  2. using ARMeilleure.Translation;
  3. namespace Ryujinx.Cpu
  4. {
  5. public class CpuContext
  6. {
  7. private readonly Translator _translator;
  8. public CpuContext(MemoryManager memory)
  9. {
  10. _translator = new Translator(new JitMemoryAllocator(), memory);
  11. memory.UnmapEvent += UnmapHandler;
  12. }
  13. private void UnmapHandler(ulong address, ulong size)
  14. {
  15. _translator.InvalidateJitCacheRegion(address, size);
  16. }
  17. public static ExecutionContext CreateExecutionContext()
  18. {
  19. return new ExecutionContext(new JitMemoryAllocator());
  20. }
  21. public void Execute(ExecutionContext context, ulong address)
  22. {
  23. _translator.Execute(context, address);
  24. }
  25. }
  26. }