include vmm.inc
mov ah, SegOffset ; client register containing the segment
mov al, OffOffset ; client register containing the offset
VMMCall Map_Flat
cmp eax, -1 ; -1 if error
je error
mov [LinAddr], eax ; ring-0 linear address
Converts the address contained in the specified client registers to a linear address. The given address is either a selector:offset or segment:offset address, depending on the execution mode of the current virtual machine. Uses EAX, Flags.
The SegOffset and OffOffset parameters specify offsets, in bytes, relative to the beginning of the Client_Reg_Struc structure for the current virtual machine.
Before converting an address, Map_Flat checks the current execution mode and, for protected-mode applications, the bitness of the DPMI client. 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.
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
It is typically more convenient to use the Client_Ptr_Flat macro instead.
Client_Ptr_Flat