#include <oskit/x86/base_paging.h>int ptab_alloc([out] oskit_addr_t *out_ptab_pa);
All of the following page mapping routines call this function to allocate new page tables as needed to create page mappings. It attempts to allocate a single page of physical memory, and if successful, returns 0 with the physical address of that page in *out_ptab_pa. The newly allocated page is cleared to all zeros by this function. If this function is unsuccessful, it returns nonzero.The default implementation of this function assumes that the OSKit's minimal C library (libc) and list-based memory manager (liblmm) are being used to manage physical memory, and allocates page table pages from the malloc_lmm memory pool (see Section 9.5.1). However, in more complete OS environments, e.g., in which low physical memory conditions should trigger a page-out rather than failing immediately, this routine can be overridden to provide the desired behavior.
- out_ptab_pa
- The address of a variable of type oskit_addr_t into which this function will deposit the physical address of the allocated page, if the allocation was successful.
Returns zero if the allocation was successful, or nonzero on failure.
- lmm_alloc_page
- 15.6.8
- malloc_lmm
- 9.5.1
- memset
- 9.4.18
- kvtophys
- 10.6.2