move syscall_nr to generic for sharing between arch impls
[lunaix-os.git] / lunaix-os / arch / generic / vmutils.c
1 #include <lunaix/mm/pagetable.h>
2 #include <lunaix/mm/page.h>
3
4 _default struct leaflet*
5 dup_leaflet(struct leaflet* leaflet)
6 {
7     fail("unimplemented");
8 }
9
10 _default void
11 pmm_arch_init_pool(struct pmem* memory)
12 {
13     pmm_declare_pool(POOL_UNIFIED, 1, memory->list_len);
14 }
15
16 _default ptr_t
17 pmm_arch_init_remap(struct pmem* memory, struct boot_handoff* bctx)
18 {
19     fail("unimplemented");
20 }
21
22 _default pte_t
23 translate_vmr_prot(unsigned int vmr_prot, pte_t pte)
24 {
25     pte = pte_mkuser(pte);
26
27     if ((vmr_prot & PROT_WRITE)) {
28         pte = pte_mkwritable(pte);
29     }
30
31     if ((vmr_prot & PROT_EXEC)) {
32         pte = pte_mkexec(pte);
33     }
34     else {
35         pte = pte_mknexec(pte);
36     }
37
38     return pte;
39 }