[arch][arm64][mmu] use slightly more efficient pmm_alloc_page routine

Only used when allocating page size aligned page tables, which is the
common case.
This commit is contained in:
Travis Geiselbrecht
2020-05-10 16:50:19 -07:00
parent 7cc7d79e74
commit 0b6866830d

View File

@@ -193,7 +193,13 @@ static int alloc_page_table(paddr_t *paddrp, uint page_size_shift) {
LTRACEF("page_size_shift %u\n", page_size_shift);
if (size >= PAGE_SIZE) {
if (size == PAGE_SIZE) {
vm_page_t *p = pmm_alloc_page();
if (!p) {
return ERR_NO_MEMORY;
}
*paddrp = vm_page_to_paddr(p);
} else if (size > PAGE_SIZE) {
size_t count = size / PAGE_SIZE;
size_t ret = pmm_alloc_contiguous(count, page_size_shift, paddrp, NULL);
if (ret != count)