9#include "mos/platform/platform_defs.h"
15#if MOS_PLATFORM_PAGING_LEVELS < 4
24 return pml4.pml3.table;
34 return (pml3_t){ .table = (
pml3e_t *) pml4e };
40 for (
size_t i = pml4_index(*vaddr); i <
PML4_ENTRIES && *n_pages; i++)
55 *n_pages -=
MIN(*n_pages, PML4E_NPAGES);
71#if MOS_PLATFORM_PAGING_LEVELS <= 4
74 const bool should_zap_this_pml4 = pml4_index(*vaddr) == 0 && *n_pages >=
PML4_ENTRIES * PML4E_NPAGES;
77 for (
size_t i = pml4_index(*vaddr); i <
PML4_ENTRIES && *n_pages; i++)
91 *n_pages -=
MIN(*n_pages, PML4E_NPAGES);
96 if (should_zap_this_pml4)
99 return should_zap_this_pml4;
104 return &pml4.table[pml4_index(vaddr)];
bool platform_pml4e_get_present(const pml4e_t *pml4)
void platform_pml4e_set_pml3(pml4e_t *pml4, pml3_t pml3, pfn_t pml3_pfn)
pml3_t platform_pml4e_get_pml3(const pml4e_t *pml4)
bool callback(pb_istream_t *stream, uint8_t *buf, size_t count)
bool pml3e_is_present(const pml3e_t *pml3e)
void pml3_traverse(pml3_t pml3, ptr_t *vaddr, size_t *n_pages, pagetable_walk_options_t callback, void *data)
__nodiscard bool pml3_destroy_range(pml3_t pml3, ptr_t *vaddr, size_t *n_pages)
void pml4_traverse(pml4_t pml4, ptr_t *vaddr, size_t *n_pages, pagetable_walk_options_t callback, void *data)
pml4e_t * pml4_entry(pml4_t pml4, ptr_t vaddr)
bool pml4e_is_present(const pml4e_t *pml4e)
pml3_t pml4e_get_pml3(const pml4e_t *pml4e)
__nodiscard bool pml4_destroy_range(pml4_t pml4, ptr_t *vaddr, size_t *n_pages)
pml3_t pml4e_get_or_create_pml3(pml4e_t *pml4e)
#define pml_destroy_table(x)
#define pml_create_table(x)
#define pmlxe_destroy(pmlxe)
void(* pml4e_pre_traverse)(pml4_t pml4, pml4e_t *e, ptr_t vaddr, void *data)