aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Memory/MemoryManagement.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/Memory/MemoryManagement.cs')
-rw-r--r--ARMeilleure/Memory/MemoryManagement.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/ARMeilleure/Memory/MemoryManagement.cs b/ARMeilleure/Memory/MemoryManagement.cs
index e299ae49..ba62f8e7 100644
--- a/ARMeilleure/Memory/MemoryManagement.cs
+++ b/ARMeilleure/Memory/MemoryManagement.cs
@@ -44,6 +44,25 @@ namespace ARMeilleure.Memory
}
}
+ public static bool Commit(IntPtr address, ulong size)
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ IntPtr sizeNint = new IntPtr((long)size);
+
+ return MemoryManagementWindows.Commit(address, sizeNint);
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
+ RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ return MemoryManagementUnix.Commit(address, size);
+ }
+ else
+ {
+ throw new PlatformNotSupportedException();
+ }
+ }
+
public static void Reprotect(IntPtr address, ulong size, MemoryProtection permission)
{
bool result;
@@ -70,6 +89,25 @@ namespace ARMeilleure.Memory
}
}
+ public static IntPtr Reserve(ulong size)
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ IntPtr sizeNint = new IntPtr((long)size);
+
+ return MemoryManagementWindows.Reserve(sizeNint);
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
+ RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ return MemoryManagementUnix.Reserve(size);
+ }
+ else
+ {
+ throw new PlatformNotSupportedException();
+ }
+ }
+
public static bool Free(IntPtr address)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))