Showing changes from revision #0 to #1:
Added | Removed | Changed
Entry | |
---|---|
R0 | 23, and flags: |
Bit 8: 0 to reserve, 1 to release reservation | |
Bits 9+: Reserved (set to 0) | |
R1 | Base page number |
R2 | Number of pages |
Exit | |
---|---|
R0 | Preserved |
R1 | Preserved |
R2 | Preserved |
The purpose of this call is to reserve a consecutive number of RAM pages, or to release the reservation of a consecutive number of RAM pages. This is the only call which can alter bit 7 of the Memory Page Access Flags.
When reserving a range of pages, if any of the pages are already reserved the operation will fail with an error without modifying the reservation state of any of the pages.
Reserved pages differ from un-reserved pages in the following ways:
Reserved pages are intended to be used in situations where a program knows that it needs a certain set of physical pages (e.g. for future use by another bus master), but it doesn’t need all of the pages right now. For example, the PCI heap (used for PCI_RAMAlloc & PCI_RAMFree) and the legacy screen dynamic area are both dynamic areas which grow and shrink on demand, but also require physically contiguous memory to operate correctly. It’s always been the case that pages which have been explicitly requested by PreGrow handlers won’t be recommended by OS_Memory 12, and can’t be requested by other dynamic areas. This protects the memory which the PCI heap & screen are currently using. But OS_Memory 12 has no knowledge about what memory they may want to use in the future. So if a third dynamic area comes along which wants physically contiguous pages, OS_Memory 12 may recommend that it uses pages which the PCI module was intending to use. When the third dynamic area makes use of that memory, it will be blocking the PCI heap from growing above a certain size, even if there’s plenty of other free memory spare in the system. OS_Memory 23 solves this problem by allowing the dynamic area owners to signify their intent to use the memory (in addition to providing some protection against dynamic areas accidentally using pages which have been reserved by other systems).