ICpuContext.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. namespace Ryujinx.Cpu
  2. {
  3. /// <summary>
  4. /// CPU context interface.
  5. /// </summary>
  6. public interface ICpuContext
  7. {
  8. /// <summary>
  9. /// Creates a new execution context that will store thread CPU register state when executing guest code.
  10. /// </summary>
  11. /// <param name="exceptionCallbacks">Optional functions to be called when the CPU receives an interrupt</param>
  12. /// <returns>Execution context</returns>
  13. IExecutionContext CreateExecutionContext(ExceptionCallbacks exceptionCallbacks);
  14. /// <summary>
  15. /// Starts executing code at a specified entry point address.
  16. /// </summary>
  17. /// <remarks>
  18. /// This function only returns when the execution is stopped, by calling <see cref="IExecutionContext.StopRunning"/>.
  19. /// </remarks>
  20. /// <param name="context">Execution context to be used for this run</param>
  21. /// <param name="address">Entry point address</param>
  22. void Execute(IExecutionContext context, ulong address);
  23. /// <summary>
  24. /// Invalidates the instruction cache for a given memory region.
  25. /// </summary>
  26. /// <remarks>
  27. /// This should be called if code is modified to make the CPU emulator aware of the modifications,
  28. /// otherwise it might run stale code which will lead to errors and crashes.
  29. /// Calling this function is not necessary if the code memory was modified by guest code,
  30. /// as the expectation is that it will do it on its own using the appropriate cache invalidation instructions,
  31. /// except on Arm32 where those instructions can't be used in unprivileged mode.
  32. /// </remarks>
  33. /// <param name="address">Address of the region to be invalidated</param>
  34. /// <param name="size">Size of the region to be invalidated</param>
  35. void InvalidateCacheRegion(ulong address, ulong size);
  36. }
  37. }