x86: paging: add end of reserved memory check

if users call the mapping function without specifying a physical page to use,
then the function uses a page from a reserved pool. Check that we don't finish
them.
pull/365/head
Marco Oliverio 2023-09-12 14:55:03 +00:00
parent e95dad8dfe
commit ce90b3b7dc
1 changed files with 4 additions and 0 deletions

View File

@ -197,6 +197,10 @@ static void x86_paging_map_page(uint64_t vaddress, uint64_t paddress)
if (paddress == 0) {
paddress = (uint64_t)mem;
mem += PAGE_TABLE_PAGE_SIZE;
if (mem >= _mem + MEM_SIZE) {
wolfBoot_printf("No more pages to satisfy virtual allocation");
panic();
}
}
x86_paging_setup_entry(pl1e, paddress);
}