_MapFreePhysReg

include vmm.inc

VMMcall _MapFreePhysReg, <LinPgNum, nPages, flags>

or eax,eax ; nonzero if mapped, zero if error

je not_mapped


The _MapFreePhysReg service maps one or more physical pages into a free physical region. The service maps physical pages currently in the free list to the specified pages in the region.

Parameters

LinPgNum

Specifies the linear page number of the first page to map. The page must be in a free physical region previously created using the _PageAllocate service. A linear page number is a linear address shifted right by 12 bits right.

nPages

Specifies number of pages to map. All pages must be within the free physical region.

flags

Specifies the operation flags. This parameter can be the following value:

Value Meaning

PageFixed Maps the specified pages as fixed pages, permanently locking the pages at the specified address. If this value is not given, the pages are not fixed. Virtual devices never return fixed pages to the system.

All other values are reserved.

Return Value

The EAX register contains a nonzero value if the service is successful. Otherwise, EAX contains returns zero specifying an invalid linear page number, an invalid range of pages, part of the page range already present, insufficient number of pages on free list, or an invalid use of the PageFixed value.

Comments

This service is intended to be used in a free-physical-region callback procedure installed using the _SetFreePhysRegCalBk service. Virtual devices should not call this service until after the Sys_VM_Init message or the Init_Complete message has been received.

The PageFixed value allows a virtual device to maintain a cache of memory which has a minimum size. The virtual device maps a predetermined number of pages using the PageFixed value to ensure that this cache has its minimum size. The virtual device never unmaps these pages. The virtual device maps any additional pages without using the PageFixed value. This allows these pages to be unmapped later. Occasionally, there may be too few physical pages to attain the minimum cache size. The virtual device must be prepared to handle this condition.

Uses

EAX

See Also

_SetFreePhysRegCalBk, _UnmapFreePhysReg