From a53cfdab78c382677eb826bd5bedb58b3b838796 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 29 Jan 2023 08:37:52 -0300 Subject: Initial Apple Hypervisor based CPU emulation (#4332) * Initial Apple Hypervisor based CPU emulation implementation * Add UseHypervisor Setting * Add basic MacOS support to Avalonia * Fix initialization * Fix GTK build * Fix/silence warnings * Change exceptions to asserts on HvAddressSpaceRange * Replace DllImport with LibraryImport * Fix LibraryImport * Remove unneeded usings * Revert outdated change * Set DiskCacheLoadState when using hypervisor too * Fix HvExecutionContext PC value * Address PR feedback * Use existing entitlements.xml file on distribution folder --------- Co-authored-by: riperiperi --- Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs (limited to 'Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs') diff --git a/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs b/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs new file mode 100644 index 00000000..94289d1c --- /dev/null +++ b/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs @@ -0,0 +1,34 @@ +using Ryujinx.Memory; +using System; + +namespace Ryujinx.Cpu.AppleHv +{ + struct HvMemoryBlockAllocation : IDisposable + { + private readonly HvMemoryBlockAllocator _owner; + private readonly HvMemoryBlockAllocator.Block _block; + + public bool IsValid => _owner != null; + public MemoryBlock Memory => _block.Memory; + public ulong Ipa => _block.Ipa; + public ulong Offset { get; } + public ulong Size { get; } + + public HvMemoryBlockAllocation( + HvMemoryBlockAllocator owner, + HvMemoryBlockAllocator.Block block, + ulong offset, + ulong size) + { + _owner = owner; + _block = block; + Offset = offset; + Size = size; + } + + public void Dispose() + { + _owner.Free(_block, Offset, Size); + } + } +} -- cgit v1.2.3