예제 #1
0
        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));
            }
        }