aa64: finalise context switch, page fault handler and syscall
[lunaix-os.git] / lunaix-os / arch / aarch64 / vmutils.c
1 #include <lunaix/mm/pagetable.h>
2 #include <lunaix/mm/page.h>
3
4 struct leaflet*
5 dup_leaflet(struct leaflet* leaflet)
6 {
7     ptr_t dest_va, src_va;
8     struct leaflet* new_leaflet;
9     
10     new_leaflet = alloc_leaflet(leaflet_order(leaflet));
11
12     src_va = leaflet_mount(leaflet);
13     dest_va = vmap(new_leaflet, KERNEL_DATA);
14
15     memcpy((void*)dest_va, (void*)src_va, PAGE_SIZE);
16
17     leaflet_unmount(leaflet);
18     vunmap(dest_va, new_leaflet);
19
20     return new_leaflet;
21 }
22
23 ptr_t
24 pmm_arch_init_remap(struct pmem* memory, struct boot_handoff* bctx)
25 {
26     unsigned long plist_len;
27
28     plist_len = leaf_count(bctx->mem.size) * sizeof(struct ppage);
29
30     for (int i = 0; i < bctx->mem.mmap_len; i++) {
31         
32     }
33 }