_LinMapIntoV86


include vmm.inc

VMMcall _LinMapIntoV86, <HLinPgNum, VM, VMLinPgNum, nPages, flags>
or      eax, eax            ; zero if error
jz      not_mapped
mov     [V86Address], eax   ; V86 address for mapped pages

Maps one or more pages into the V86 address space of the specified virtual machine. This service is similar to the _MapIntoV86 service. Uses EAX, ECX, EDX, and Flags.

HLinPgNum

Linear page number of the first page to map. A linear page number is a ring-0 linear address shifted right by 12 bits.

VM

Handle of the virtual machine for which memory is mapped.

VMLinPgNum

Linear page number of an address in the V86 address space. The service maps the specified pages to this address if the HLinPgNum parameter does not already specify a valid V86 address. This parameter must be a page number in the range 10h through 10Fh.

nPages

Number of pages to map.

flags

Operation flags. Can be zero or the MAPV86_IGNOREWRAP value. This value enables the caller to treat the high memory area (HMA) simply as an extension of the V86 address space, whether or not wrap is enabled.

If MAPV86_IGNOREWRAP is specified and wrap is enabled, the service updates only the HMA alias mapping for pages in the HMA, not the currently-visible mapping. The HMA corresponds to page numbers 100h through 10Fh.

A virtual device typically uses this service to map buffers having protected-mode addresses into the V86 address space. This gives software running in the virtual machine a means of passing data to and receiving data from the virtual device.

If HLinPgNum is a V86 page number (that is less than or equal to 100h), this service returns HLinPgNum immediately and does nothing else. Otherwise, the service returns VMLinPgNum.

If the specified linear pages belong to a free physical region, this service calls the _PhysIntoV86 service to carry out the request.

If the specified linear pages belong to the high addressing region for a virtual machine, this service maps the memory from that virtual machine into the virtual machine specified by the VM parameter. The V86MMGR device uses this capability to map a region of V86 address space which is currently local to one VM into a global region that is addressable by all virtual machines. Virtual devices must not use this capability directly; they should always use the V86MMGR services to map local memory into global memory.

Although a virtual device can map the same page into multiple addresses in the V86 address space, this is not recommended.

For each mapped page, this service sets the P_USER, P_PRES, and P_WRITE bits, but clears the P_DIRTY and P_ACC bits. The service sets the page type to be identical to the page type for the pages at the specified protected-mode linear address.

If the virtual page swap device uses MS-DOS or BIOS functions to write to the device, this service automatically locks all mapped pages and unlocks any previously mapped pages.

If a virtual device no longer needs the mapped region, it should map the system nul page into the V86 address space using the _MapIntoV86 service. A virtual device can retrieve the handle for the system nul page using the _GetNulPageHandle service.

This service accepts V86 page numbers between 10h and the page number returned by the _GetFirstV86Page service. This supports virtual devices that use the _Allocate_Global_V86_Data_Area service. Mapping a region which spans across the first V86 page is not allowed. Mapping pages in this region to other addresses can easily crash the system, and should be avoided.

See also _Allocate_Global_V86_Data_Area, _GetFirstV86Page, _GetNulPageHandle, _MapIntoV86, _PageLock, _PhysIntoV86