aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs')
-rw-r--r--Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs34
1 files changed, 34 insertions, 0 deletions
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);
+ }
+ }
+}