Map_Lin_To_VM_Addr

include vmm.inc

mov eax, LineAddr ; linear address to convert

mov ecx, Limit ; segment limit in bytes

VMMcall Map_Lin_To_VM_Addr

jc error ; carry flag set if error

mov [SegSel], cx ; segment or selector

mov [Offset], edx ; address offset


The Map_Lin_To_VM_Addr service converts a 32-bit ring-0 linear address into an V86 or protected-mode address. This service converts the address for use with the current execution mode of the current virtual machine.

Parameters

LinAddr

Specifies the linear address to convert.

Limit

Specifies the zero-based segment limit (0 specifies a one-byte segment, 1 is a two-byte segment, and so on). This parameter is used only if the service creates an LDT selector.

Return Value

If the carry flag is clear, the CX register contains the segment address or selector, and EDX register contains the address offset. This offset is always zero if the virtual machine is running a protected-mode application.

The carry flag is set to indicate an error, such as no LDT selectors available.

Comments

If the virtual machine is running in V86 mode, the LineAddr parameter must specify a linear address that is within the 1 megabyte V86 address space of the current virtual machine. The service returns a segment:offset pair.

If the virtual machine is running a protected-mode application, the service returns a selector:offset pair. This service creates a new selector in the current virtual machine's LDT if the specified base and limit values do not match a selector the service previously allocated.

A virtual device must never free a selector that is returned by this service. For this reason, this service should be used sparingly.

Uses

ECX, EDX, Flags

See Also

Map_Flat