namespace Ryujinx.Cpu { /// /// CPU context interface. /// public interface ICpuContext { /// /// Creates a new execution context that will store thread CPU register state when executing guest code. /// /// Optional functions to be called when the CPU receives an interrupt /// Execution context IExecutionContext CreateExecutionContext(ExceptionCallbacks exceptionCallbacks); /// /// Starts executing code at a specified entry point address. /// /// /// This function only returns when the execution is stopped, by calling . /// /// Execution context to be used for this run /// Entry point address void Execute(IExecutionContext context, ulong address); /// /// Invalidates the instruction cache for a given memory region. /// /// /// This should be called if code is modified to make the CPU emulator aware of the modifications, /// otherwise it might run stale code which will lead to errors and crashes. /// Calling this function is not necessary if the code memory was modified by guest code, /// as the expectation is that it will do it on its own using the appropriate cache invalidation instructions, /// except on Arm32 where those instructions can't be used in unprivileged mode. /// /// Address of the region to be invalidated /// Size of the region to be invalidated void InvalidateCacheRegion(ulong address, ulong size); /// /// Loads cached code from disk for a given application. /// /// /// If the execution engine is recompiling guest code, this can be used to load cached code from disk. /// /// Title ID of the application in padded hex form /// Version of the application /// True if the cache should be loaded from disk if it exists, false otherwise /// Disk cache load progress reporter and manager IDiskCacheLoadState LoadDiskCache(string titleIdText, string displayVersion, bool enabled); /// /// Indicates that code has been loaded into guest memory, and that it might be executed in the future. /// /// /// Some execution engines might use this information to cache recompiled code on disk or to ensure it can be executed. /// /// CPU virtual address where the code starts /// Size of the code range in bytes void PrepareCodeRange(ulong address, ulong size); } }