Merge branch 'interrupt-rework' into prog-loader
[lunaix-os.git] / lunaix-os / includes / lunaix / mm / mmap.h
1 #ifndef __LUNAIX_MMAP_H
2 #define __LUNAIX_MMAP_H
3
4 #include <lunaix/fs.h>
5 #include <lunaix/mm/region.h>
6 #include <lunaix/types.h>
7
8 struct mmap_param
9 {
10     ptr_t vms_mnt;        // vm mount point
11     struct proc_mm* pvms; // process vm
12     off_t offset;         // mapped file offset
13     size_t mlen;          // mapped memory length
14     size_t flen;          // mapped file length
15     u32_t proct;          // protections
16     u32_t flags;          // other options
17     u32_t type;           // region type
18 };
19
20 int
21 mem_map(void** addr_out,
22         struct mm_region** created,
23         void* addr,
24         struct v_file* file,
25         struct mmap_param* param);
26
27 int
28 mem_unmap(ptr_t mnt, vm_regions_t* regions, void* addr, size_t length);
29
30 void
31 mem_unmap_region(ptr_t mnt, struct mm_region* region);
32
33 void
34 mem_sync_pages(ptr_t mnt,
35                struct mm_region* region,
36                ptr_t start,
37                ptr_t length,
38                int options);
39
40 int
41 mem_msync(ptr_t mnt,
42           vm_regions_t* regions,
43           ptr_t addr,
44           size_t length,
45           int options);
46
47 #endif /* __LUNAIX_MMAP_H */