Map_Flat

include vmm.inc

mov ah, SegOffset ; offset in Client_Reg_Struc to segment register

mov al, OffOffset ; offset in Client_Reg_Struc to offset register

VMMcall Map_Flat

cmp eax, -1 ; -1 if error

je error

mov [LinAddr], eax ; ring-0 linear address


The Map_Flat service converts a segment:offset or selector:offset pair into a linear address. This service works only for the current virtual machine. It determines whether the value passed to it is a V86 segment, or a protected-mode selector by the execution mode of the current virtual machine.

Parameters

SegOffset

Specifies the offset (in bytes) from the start of the Client_Reg_Struc structure to the segment register that contains the segment address or selector to convert.

OffOffset

Specifies the offset (in bytes) from the start of the Client_Reg_Struc structure to the register that contains the address offset to convert. If this parameter is -1, this service uses 0 as the address offset to convert.

Return Value

The EAX register contains the ring-0 linear address that corresponds to the specified V86 or protected-mode address. The EAX register contains -1 if the specified selector is invalid.

Comment

Before converting an address, Map_Flat checks the current execution mode and, for protected-mode applications, the segment granularity (16- or 32-bit offsets). If the virtual machine is running a 32-bit protected mode application, it uses 32-bit address offsets. For V86 and 16-bit protected-mode applications, it uses 16-bit address offsets and ignores the high word if the OffOffset parameter specifies a 32-bit register.

Example

The following example converts the address Client_DS:Client_DX and returns the linear address in EAX:

mov ax, (Client_DS SHL 8) + Client_DX

VMMcall Map_Flat

Uses

EAX, Flags

See Also

Client_Ptr_Flat