internal static UIntPtr KernelMapPhysicalMemory(PhysicalAddress physStart, UIntPtr numBytes) { if (useAddressTranslation) { UIntPtr permaLoc = VMManager.TranslatePhysicalRange(physStart, numBytes); if (permaLoc != UIntPtr.Zero) { // This location has a permanent mapping return(permaLoc); } else { // This location must be mapped on the fly return(VMManager.MapPhysicalMemory(KernelRangeWrapper, Process.kernelProcess, physStart, numBytes)); } } else { // identity map without paging return(unchecked ((UIntPtr)physStart.Value)); } }
internal static UIntPtr UserMapPhysicalMemory(PhysicalAddress physStart, UIntPtr numBytes) { return(useAddressTranslation ? VMManager.MapPhysicalMemory(ProtectionDomain.CurrentDomain.UserRange, Thread.CurrentProcess, physStart, numBytes) : unchecked ((UIntPtr)physStart.Value)); }