_AddFreePhysPage


include vmm.inc

VMMcall _AddFreePhysPage, <PhysPgNum, nPages, flags>

mov     [PagesAdded], eax       ; 0 = none, 1 = some, 2 = all

Adds one or more physical pages to the free memory pool. Virtual devices use this service to add pages that the Windows loader could not find, but that the virtual device did find. For example, the V86MMGR device adds any unused physical pages it finds when using the Global EMM Import function of a 386 LIMulator. Uses EAX, ECX, EDX, and Flags.

This service is only available during initialization, and only in Windows version 3.1 and later.

Value

Meaning

0

None of the specified physical pages were added to the free pool.

1

Some, but not all, of the specified physical pages were added.

2

All of the specified physical pages were added.


PhysPgNum

Physical page number of the first page to add. The page number must be greater than or equal to 110h; only extended memory pages may be added to the pool. The specified pages must be read/write physical memory pages, and must be available for use at any time.

nPages

Number of physical pages to add.

flags

Operation flags. Can be zero or the following value:

Value

Meaning

AFPP_RECEXIT

The physical memory being added will be automatically restored to its original state (original contents, and in an unused and unmapped state) immediately before System_Exit. No more than 32 pages can be added per call using this feature; to add more than 32 pages, make multiple calls.


A virtual device must not attempt to use pages once it has added them to the free pool, or attempt to add pages that are already available to the system.

This service returns an error if the number of pages to add exceeds the limit of the internal data structure the system uses to manage the free pool. The internal data structure is allocated during initialization and cannot be modified.

Most virtual devices do not need to use this service.

See also _GetFreePageCount