Ryujinx-uplift/src/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocation.cs
gdkchan ddc9ae2a83
Add VTimer as alternative interrupt method on Apple Hypervisor (#5663)
* Add VTimer as alternative interrupt method on Apple Hypervisor

* Fix naming violations on TimeApi

* Fix timer interval (was 16us rather than 16ms)

* Fix delta ticks calculation

* Missing ThrowOnError call

* Add SupportedOSPlatform attribute on AppleHv classes
2023-09-26 01:18:32 +02:00

37 lines
948 B
C#

using Ryujinx.Memory;
using System;
using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
readonly 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);
}
}
}