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.
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.
_Allocate_Global_V86_Data_Area, _GetFirstV86Page, _GetNulPageHandle, _MapIntoV86, _PageLock, _PhysIntoV86