1 #ifndef __LUNAIX_PROCVM_H
2 #define __LUNAIX_PROCVM_H
4 #include <lunaix/ds/llist.h>
5 #include <lunaix/ds/mutex.h>
7 #include <lunaix/types.h>
14 struct llist_header head; // must be first field!
15 struct proc_mm* proc_vms;
17 // file mapped to this region
22 u32_t flen; // XXX it seems that we don't need this actually..
28 void** index; // fast reference, to accelerate access to this very region.
31 // when a region is copied
32 void (*region_copied)(struct mm_region*);
33 // when a region is unmapped
34 void (*destruct_region)(struct mm_region*);
47 mm_index(void** index, struct mm_region* target)
49 *index = (void*)target;
50 target->index = index;
53 typedef struct llist_header vm_regions_t;
57 // virtual memory root (i.e. root page table)
60 struct mm_region* heap;
61 struct proc_info* proc;
65 * @brief Create a process virtual memory space descriptor
68 * @return struct proc_mm*
71 procvm_create(struct proc_info* proc);
74 * @brief Initialize the vm of `proc` to duplication of current process
77 * @return struct proc_mm*
80 procvm_dup(struct proc_info* proc);
83 procvm_cleanup(ptr_t vm_mnt, struct proc_info* proc);
87 * @brief Initialize the vm of `proc` as a clean slate which contains
88 * nothing but shared global mapping of kernel image.
93 procvm_init_clean(struct proc_info* proc);
97 remote virtual memory manipulation
100 #define REMOTEVM_MAX_PAGES 128
103 procvm_enter_remote_transaction(struct remote_vmctx* rvmctx, struct proc_mm* mm,
104 ptr_t vm_mnt, ptr_t remote_base, size_t size);
107 procvm_copy_remote(struct remote_vmctx* rvmctx,
108 ptr_t remote_dest, void* local_src, size_t sz);
111 procvm_exit_remote_transaction(struct remote_vmctx* rvmctx);
113 #endif /* __LUNAIX_PROCVM_H */