feat: basic elf32 loader (only LOAD segment is supported)
[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;
11     vm_regions_t* regions;
12     off_t offset;
13     size_t length;
14     u32_t proct;
15     u32_t flags;
16     u32_t type;
17 };
18
19 int
20 mem_map(void** addr_out,
21         struct mm_region** created,
22         void* addr,
23         struct v_file* file,
24         struct mmap_param* param);
25
26 int
27 mem_unmap(ptr_t mnt, vm_regions_t* regions, void* addr, size_t length);
28
29 void
30 mem_sync_pages(ptr_t mnt,
31                struct mm_region* region,
32                ptr_t start,
33                ptr_t length,
34                int options);
35
36 int
37 mem_msync(ptr_t mnt,
38           vm_regions_t* regions,
39           ptr_t addr,
40           size_t length,
41           int options);
42
43 #endif /* __LUNAIX_MMAP_H */