1 | // SPDX-License-Identifier: GPL-3.0-or-later |
2 | |
3 | #include "mos/mm/paging/table_ops/do_flag.h" |
4 | |
5 | static void pml1e_do_flag_callback(pml1_t pml1, pml1e_t *e, ptr_t vaddr, void *data) |
6 | { |
7 | MOS_UNUSED(pml1); |
8 | MOS_UNUSED(vaddr); |
9 | if (platform_pml1e_get_present(pml1: e)) |
10 | { |
11 | struct pagetable_do_flag_data *flag_data = data; |
12 | platform_pml1e_set_flags(pml1: e, flags: flag_data->flags); |
13 | platform_invalidate_tlb(vaddr); |
14 | } |
15 | } |
16 | |
17 | static void pml2e_do_flag_callback(pml2_t pml2, pml2e_t *e, ptr_t vaddr, void *data) |
18 | { |
19 | MOS_UNUSED(pml2); |
20 | MOS_UNUSED(vaddr); |
21 | struct pagetable_do_flag_data *flag_data = data; |
22 | platform_pml2e_set_flags(pml2: e, flags: flag_data->flags); |
23 | } |
24 | |
25 | static void pml3e_do_flag_callback(pml3_t pml3, pml3e_t *e, ptr_t vaddr, void *data) |
26 | { |
27 | MOS_UNUSED(pml3); |
28 | MOS_UNUSED(vaddr); |
29 | struct pagetable_do_flag_data *flag_data = data; |
30 | platform_pml3e_set_flags(pml3: e, flags: flag_data->flags); |
31 | } |
32 | |
33 | static void pml4e_do_flag_callback(pml4_t pml4, pml4e_t *e, ptr_t vaddr, void *data) |
34 | { |
35 | MOS_UNUSED(pml4); |
36 | MOS_UNUSED(vaddr); |
37 | struct pagetable_do_flag_data *flag_data = data; |
38 | platform_pml4e_set_flags(pml4: e, flags: flag_data->flags); |
39 | } |
40 | |
41 | const pagetable_walk_options_t pagetable_do_flag_callbacks = { |
42 | .pml1e_callback = pml1e_do_flag_callback, |
43 | .pml2e_pre_traverse = pml2e_do_flag_callback, |
44 | .pml3e_pre_traverse = pml3e_do_flag_callback, |
45 | .pml4e_pre_traverse = pml4e_do_flag_callback, |
46 | }; |
47 | |