简体   繁体   中英

How to determine if a logical address is in physical memory?

My callback function that is used at a higher IRQL may need to access a range of addresses in memory. So I'm wondering if there's a kernel function that can tell if an address PVOID is in the NonPagedPool section of memory, or is currently mapped to physical memory and won't cause a page fault if I read from it?

MmIsAddressValid will check whether a page fault will occur at the specified address residing in a non-paged pool. Microsoft warns against using this function because if the address passed is paged out, it will result in undefined behavior. This also checks if the virtual address is within the range for physical memory and checks for a valid PTE and returns false if the conditions are not met.

MmGetPhysicalAddress will return the physical address for a virtual address residing in the non-paged pool. This returns zero if the correct conditions are not met for the routine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM