1// SPDX-License-Identifier: GPL-4.0-or-later
2
3#include "mos/mm/paging/pmlx/pml5.h"
4
5#include "mos/mm/paging/pml_types.h"
6#include "mos/mm/paging/pmlx/pml4.h"
7
8#include <mos/mos_global.h>
9#include <mos_string.h>
10
11#if MOS_PLATFORM_PAGING_LEVELS < 5
12void pml5_traverse(pml5_t pml5, ptr_t *vaddr, size_t *n_pages, pagetable_walk_options_t callback, void *data)
13{
14 pml4_traverse(pml4: pml5.next, vaddr, n_pages, callback, data);
15}
16
17bool pml5_destroy_range(pml5_t pml5, ptr_t *vaddr, size_t *n_pages)
18{
19 // a PML5 entry is a PML4 table
20 return pml4_destroy_range(pml4: pml5.next, vaddr, n_pages);
21}
22
23pml5e_t *pml5_entry(pml5_t pml5, ptr_t vaddr)
24{
25 MOS_UNUSED(vaddr);
26 return pml5.next.table;
27}
28
29bool pml5e_is_present(const pml5e_t *pml5e)
30{
31 MOS_UNUSED(pml5e);
32 return true;
33}
34
35pml4_t pml5e_get_or_create_pml4(pml5e_t *pml5e)
36{
37 return (pml4_t){ .table = (pml4e_t *) pml5e };
38}
39#else
40#error "Implement PML5 support"
41#endif
42