misc: Use nint/nuint instead of IntPtr/UIntPtr

This commit is contained in:
KeatonTheBot
2025-11-23 13:42:38 -06:00
parent 2d720fea03
commit c1e24961f9
163 changed files with 845 additions and 845 deletions
+2 -2
View File
@@ -273,7 +273,7 @@ namespace Ryujinx.Cpu.AppleHv
public static partial HvResult hv_vm_get_max_vcpu_count(out uint max_vcpu_count);
[LibraryImport(LibraryName, SetLastError = true)]
public static partial HvResult hv_vm_create(IntPtr config);
public static partial HvResult hv_vm_create(nint config);
[LibraryImport(LibraryName, SetLastError = true)]
public static partial HvResult hv_vm_destroy();
@@ -288,7 +288,7 @@ namespace Ryujinx.Cpu.AppleHv
public static partial HvResult hv_vm_protect(ulong ipa, ulong size, HvMemoryFlags flags);
[LibraryImport(LibraryName, SetLastError = true)]
public unsafe static partial HvResult hv_vcpu_create(out ulong vcpu, ref HvVcpuExit* exit, IntPtr config);
public unsafe static partial HvResult hv_vcpu_create(out ulong vcpu, ref HvVcpuExit* exit, nint config);
[LibraryImport(LibraryName, SetLastError = true)]
public unsafe static partial HvResult hv_vcpu_destroy(ulong vcpu);
@@ -10,9 +10,9 @@ namespace Ryujinx.Cpu.AppleHv
class HvExecutionContextVcpu : IHvExecutionContext
{
private static readonly MemoryBlock _setSimdFpRegFuncMem;
private delegate HvResult SetSimdFpReg(ulong vcpu, HvSimdFPReg reg, in V128 value, IntPtr funcPtr);
private delegate HvResult SetSimdFpReg(ulong vcpu, HvSimdFPReg reg, in V128 value, nint funcPtr);
private static readonly SetSimdFpReg _setSimdFpReg;
private static readonly IntPtr _setSimdFpRegNativePtr;
private static readonly nint _setSimdFpRegNativePtr;
static HvExecutionContextVcpu()
{
@@ -25,7 +25,7 @@ namespace Ryujinx.Cpu.AppleHv
_setSimdFpReg = Marshal.GetDelegateForFunctionPointer<SetSimdFpReg>(_setSimdFpRegFuncMem.Pointer);
if (NativeLibrary.TryLoad(HvApi.LibraryName, out IntPtr hvLibHandle))
if (NativeLibrary.TryLoad(HvApi.LibraryName, out nint hvLibHandle))
{
_setSimdFpRegNativePtr = NativeLibrary.GetExport(hvLibHandle, nameof(HvApi.hv_vcpu_set_simd_fp_reg));
}
+2 -2
View File
@@ -31,7 +31,7 @@ namespace Ryujinx.Cpu.AppleHv
public int AddressSpaceBits { get; }
public IntPtr PageTablePointer => IntPtr.Zero;
public nint PageTablePointer => nint.Zero;
public MemoryManagerType Type => MemoryManagerType.SoftwarePageTable;
@@ -248,7 +248,7 @@ namespace Ryujinx.Cpu.AppleHv
for (int i = 0; i < regions.Length; i++)
{
var guestRegion = guestRegions[i];
IntPtr pointer = _backingMemory.GetPointer(guestRegion.Address, guestRegion.Size);
nint pointer = _backingMemory.GetPointer(guestRegion.Address, guestRegion.Size);
regions[i] = new HostMemoryRange((nuint)(ulong)pointer, guestRegion.Size);
}
+1 -1
View File
@@ -72,7 +72,7 @@ namespace Ryujinx.Cpu.AppleHv
// Create VCPU.
HvVcpuExit* exitInfo = null;
HvApi.hv_vcpu_create(out ulong vcpuHandle, ref exitInfo, IntPtr.Zero).ThrowOnError();
HvApi.hv_vcpu_create(out ulong vcpuHandle, ref exitInfo, nint.Zero).ThrowOnError();
// Enable FP and SIMD instructions.
HvApi.hv_vcpu_set_sys_reg(vcpuHandle, HvSysReg.CPACR_EL1, 0b11 << 20).ThrowOnError();
+1 -1
View File
@@ -23,7 +23,7 @@ namespace Ryujinx.Cpu.AppleHv
{
if (++_addressSpaces == 1)
{
HvApi.hv_vm_create(IntPtr.Zero).ThrowOnError();
HvApi.hv_vm_create(nint.Zero).ThrowOnError();
_ipaAllocator = ipaAllocator = new HvIpaAllocator();
}
else