Entry | |
---|---|
R0 | 12, and flags |
R1 | Size of physically contiguous RAM region required (bytes) |
R2 | log2 of required alignment of base of region (eg. 12 = 4k, 20 = 1M) |
R4-R5 | Lowest acceptable physical address (inclusive) (if bit 9 of R0 set) |
R6-R7 | Highest acceptable physical address (inclusive) (if bit 9 of R0 set) |
Exit | |
---|---|
R0-R2 | Preserved |
R3 | Page number of first page of recommended region that could be grown as specific pages by dynamic area handler (only guaranteed if grow is next page claiming operation) |
This call can be used by dynamic area handlers which require blocks of physically contiguous RAM. If the call fails to find an area of the requested size/alignment, an error will be returned.
On success, the N consecutive physical page numbers starting with R3 are guaranteed to point to N pages with consecutive physical addresses which meet the requirements (where N is R1 rounded up to a page count).
Memory which has been claimed for exclusive use (e.g. via Dynamic Area PreGrow handlers, OS_DynamicArea 21 “lock” flag, or OS_Memory 23) will not be recommended.
RISC OS 5.29+ allows a physical address range to be specified in R4-R7 to restrict the search to certain ranges of physical memory. The high address in R6-R7 restricts the end of the memory block; e.g. when allocating a buffer for use by a DMA controller it should be set to the maximum permissible physical address that the controller can access. If R4-R7 is not specified, the default address range is for the first 4GB of the address space (i.e. R4,R5,R7=0 and R6=&FFFFFFFF). Note that older OS versions ignore this flag (acting as if the default “first 4GB” restriction was in place), so care must be taken if you want to restrict the recommendation to a subset of the first 4GB.