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 |
The _MapPhysToLinear service returns the linear address of the first byte in the specified range of physical addresses.
PhysAddr
Specifies the 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
Specifies the length in bytes of the physical region. The service uses this parameter to verify that the entire range is addressable.
flags
Specifies the operation flags. This parameter must be set to 0.
The EAX register contains the ring-0 linear address of the first byte of the physical region if this service is successful. Otherwise, EAX contains 0FFFFFFFFh if the specified range is not addressable.
This service is intended to be used to examine device-specific physical memory. Virtual devices must not use this service for any other purpose.
Since physical addresses do not move, the linear address returned by this service remains valid even after the virtual device returns from the Device_Init message.
The following example returns a linear address for 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.
EAX