Hypervisor

This commit is contained in:
Stossy11 2025-01-20 23:22:42 +11:00
parent 5ee90c81e9
commit 9ce29d6ad1
27 changed files with 248 additions and 27 deletions

View file

@ -6,6 +6,7 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
class HvAddressSpace : IDisposable
{
private const ulong KernelRegionBase = unchecked((ulong)-(1L << 39));

View file

@ -8,6 +8,7 @@ using System.Threading;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
class HvAddressSpaceRange : IDisposable
{
private const ulong AllocationGranule = 1UL << 14;

View file

@ -265,9 +265,10 @@ namespace Ryujinx.Cpu.AppleHv
}
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
static partial class HvApi
{
public const string LibraryName = "/System/Library/Frameworks/Hypervisor.framework/Hypervisor";
public const string LibraryName = "Hypervisor.framework/Hypervisor";
[LibraryImport(LibraryName, SetLastError = true)]
public static partial HvResult hv_vm_get_max_vcpu_count(out uint max_vcpu_count);

View file

@ -4,6 +4,7 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
class HvCpuContext : ICpuContext
{
private readonly ITickSource _tickSource;

View file

@ -3,6 +3,7 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("ios")]
[SupportedOSPlatform("macos")]
public class HvEngine : ICpuEngine
{

View file

@ -8,6 +8,7 @@ using System.Threading;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
class HvExecutionContext : IExecutionContext
{
/// <inheritdoc/>

View file

@ -7,6 +7,7 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
class HvExecutionContextVcpu : IHvExecutionContext
{
private static readonly MemoryBlock _setSimdFpRegFuncMem;

View file

@ -5,6 +5,7 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
readonly struct HvMemoryBlockAllocation : IDisposable
{
private readonly HvMemoryBlockAllocator _owner;

View file

@ -4,6 +4,7 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
class HvMemoryBlockAllocator : PrivateMemoryAllocatorImpl<HvMemoryBlockAllocator.Block>
{
public class Block : PrivateMemoryAllocator.Block

View file

@ -16,6 +16,7 @@ namespace Ryujinx.Cpu.AppleHv
/// Represents a CPU memory manager which maps guest virtual memory directly onto the Hypervisor page table.
/// </summary>
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
public class HvMemoryManager : MemoryManagerBase, IMemoryManager, IVirtualMemoryManagerTracked, IWritableBlock
{
public const int PageBits = 12;

View file

@ -4,6 +4,7 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
unsafe class HvVcpu
{
private const ulong InterruptIntervalNs = 16 * 1000000; // 16 ms

View file

@ -5,6 +5,7 @@ using System.Threading;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
class HvVcpuPool
{
// Since there's a limit on the number of VCPUs we can create,

View file

@ -5,6 +5,7 @@ using System.Runtime.Versioning;
namespace Ryujinx.Cpu.AppleHv
{
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
static class HvVm
{
// This alignment allows us to use larger blocks on the page table.

View file

@ -10,6 +10,7 @@ namespace Ryujinx.Cpu.AppleHv
}
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("ios")]
static partial class TimeApi
{
[LibraryImport("libc", SetLastError = true)]