About Free Physical Page Management

Free physical pages are unused physical addresses that the VMM can assign to committed pages when they are paged in. The Windows loader initializes the list of free physical pages. If the loader does not find certain pages that are actually available, virtual devices can use VMM services to add these to the free list.

The _AddFreePhysPage service notifies the memory manager of additional physical pages. The _PageResetHandlePAddr service also makes new physical pages available to the memory manager. However, this service simultaneously maps a range of pages in the specified memory block to the new physical pages.

Virtual devices must not attempt to add physical pages that are already under the control of the memory manager. You can determine whether physical pages exist and are recognized by the memory manager by using the _GetPhysPageInfo service.

The system creates linear address aliases for physical memory only when requested through the _MapPhysToLinear service. This is different from Windows 3.1, which created a giant linear address region to alias all of physical memory. (The change is required in order to support machines with more than 16MB of memory.) Therefore, it is imperative that linear address aliases for physical memory always be obtained through calls to _MapPhysToLinear. Do not assume that _MapPhysToLinear(N, 1, 0) is the same as _MapPhysToLinear(0, 1, 0) + N for all values of N. When you create a linear address alias, the second parameter indicates the number of bytes for which an alias is required; it is only for this number of bytes that the mapping of linear addresses to physical addresses remains contiguous. Linear address aliases are valid until the system is shut down.

See also _AddFreePhysPage, _GetPhysPageInfo, _MapPhysToLinear, _PageResetHandlePAddr