_MapIntoV86


include vmm.inc

VMMcall _MapIntoV86, <hMem, VM, VMLinPgNum, nPages, PageOff, flags>

or      eax, eax            ; nonzero if pages mapped, zero if error
jz      not_mapped

Maps one or more pages of a memory block into the V86 address space of the specified virtual machine. Uses EAX, ECX, EDX, and Flags.

hMem

Handle (base linear address) of the memory block to map. This address must have been returned by the PageAllocate, PageReAllocate, or _PageReserve service.

VM

Handle of the virtual machine for which to map the memory.

VMLinPgNum

Linear page number in the virtual machine's address space. The service maps the first page to the corresponding linear address in the V86 address space. This parameter must be in the range 10h through 10Fh.

nPages

Number of pages to map.

PageOff

Offset in pages from the beginning of the memory block to the first page to map.

flags

Operation flags. Can be one of these values:

Value

Meaning

PageDEBUGNulFault

Enables page faults for system nul pages. If the memory block contains system nul pages, a page fault occurs whenever a nul page is accessed. This value only applies when running the debugging version of the Windows virtual machine manager. If this value is not given or the debugging version is not running, no page faults occur.

MAPV86_IGNOREWRAP

If the specified pages are in the high memory area (HMA) and wrap is on, only update the HMA alias mapping, not the currently visible mapping. The HMA corresponds to pages in the range 100h to 10Fh. This allows the caller to treat the HMA simply as an extension of the V86 address space, regardless of whether wrap is enabled.


All other values are reserved.

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.

The service returns an error if the sum of the PageOff and nPages parameters is greater than the size of the memory block.

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 and clears the P_DIRTY and P_ACC bits.

If the virtual page swap device uses MS-DOS or BIOS functions to write to the hardware, _MapIntoV86 automatically locks the mapped pages and unlocks any previously mapped pages. If the virtual page swap device writes directly to the hardware, this service neither locks nor unlocks the 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 of 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, _LinMapIntoV86