diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-03-09 23:58:17 -0800 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-03-09 23:58:17 -0800 |
commit | b94c7a4b07f96f24ae7411780abf874416549f7b (patch) | |
tree | b94ca015e49392f52e5abf1209ee184fcf874db4 /pk/mmap.h | |
parent | f5a96732cb81571a3ba6b081b8556187d564f678 (diff) | |
download | pk-b94c7a4b07f96f24ae7411780abf874416549f7b.zip pk-b94c7a4b07f96f24ae7411780abf874416549f7b.tar.gz pk-b94c7a4b07f96f24ae7411780abf874416549f7b.tar.bz2 |
Refactor pk, bbl, machine into separate libraries
Yuck.
Diffstat (limited to 'pk/mmap.h')
-rw-r--r-- | pk/mmap.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/pk/mmap.h b/pk/mmap.h new file mode 100644 index 0000000..e3c2035 --- /dev/null +++ b/pk/mmap.h @@ -0,0 +1,34 @@ +#ifndef _MMAP_H +#define _MMAP_H + +#include "vm.h" +#include "syscall.h" +#include "encoding.h" +#include "file.h" +#include <stddef.h> + +#define PROT_NONE 0 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 + +#define MAP_PRIVATE 0x2 +#define MAP_FIXED 0x10 +#define MAP_ANONYMOUS 0x20 +#define MAP_POPULATE 0x8000 +#define MREMAP_FIXED 0x2 + +extern int have_vm; +uintptr_t pk_vm_init(); +int handle_page_fault(uintptr_t vaddr, int prot); +void populate_mapping(const void* start, size_t size, int prot); +void __map_kernel_range(uintptr_t va, uintptr_t pa, size_t len, int prot); +int __valid_user_range(uintptr_t vaddr, size_t len); +uintptr_t __do_mmap(uintptr_t addr, size_t length, int prot, int flags, file_t* file, off_t offset); +uintptr_t do_mmap(uintptr_t addr, size_t length, int prot, int flags, int fd, off_t offset); +int do_munmap(uintptr_t addr, size_t length); +uintptr_t do_mremap(uintptr_t addr, size_t old_size, size_t new_size, int flags); +uintptr_t do_mprotect(uintptr_t addr, size_t length, int prot); +uintptr_t do_brk(uintptr_t addr); + +#endif |