include vmm.inc VMMcall _MapPhysToLinear, <PhysAddr, nBytes, flags> cmp eax, 0FFFFFFFFh ; 0FFFFFFFFh if not addressable je not_addressable mov [Address], eax ; address of first byte
Returns the linear address of the first byte in the specified range of physical addresses. Uses EAX, ECX, EDX and Flags.
PhysAddr
32-bit physical address of the start of the region to examine. Physical addresses start at 0, thus the address of physical page 0A0h is 0A0000h.
nBytes
Length of the physical region, in bytes. The service uses this parameter to verify that the entire range is addressable.
flags
Operation flags. Must be zero.
This service is intended to be used to examine device-specific physical memory. Virtual devices must not use this service for any other purpose.
Because physical addresses do not move, the linear address returned by this service remains valid until the system is shut down. Virtual devices should be careful not to use this service in a manner that wastes linear address space.
The following example returns a linear address for 64 kilobytes of memory starting at the physical page 0A0h:
VMMcall _MapPhysToLinear,<0A0000h,10000h,0>
Since physical memory is mapped contiguously, the linear address for page 0A1h is 4096 bytes beyond the return linear address. Note, however, that no information can be concluded about the linear addresses for physical pages 9Fh or 0B0h, because they lie outside the 64KB range requested. If a virtual device needs linear address aliases for those pages, it must call _MapPhysToLinear separately for those pages.