2023-01-29 12:37:52 +01:00
|
|
|
using Ryujinx.Memory;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace Ryujinx.Cpu.AppleHv
|
|
|
|
{
|
2023-07-01 04:18:52 +02:00
|
|
|
readonly struct HvMemoryBlockAllocation : IDisposable
|
2023-01-29 12:37:52 +01:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|