aboutsummaryrefslogtreecommitdiff
path: root/pk/vm.h
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2013-07-13 21:43:57 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2013-07-13 21:44:16 -0700
commitcc72987e655578b0529b6c3c8084e810cf40b358 (patch)
treea7a99a9406dfef2d4103e85bc0976cb8d039d7e7 /pk/vm.h
parent0bdb8c84092bf7c5eb4c981c620997a5893bfb70 (diff)
downloadpk-cc72987e655578b0529b6c3c8084e810cf40b358.zip
pk-cc72987e655578b0529b6c3c8084e810cf40b358.tar.gz
pk-cc72987e655578b0529b6c3c8084e810cf40b358.tar.bz2
Support Linux ABI and (optionally) virtual memory
Diffstat (limited to 'pk/vm.h')
-rw-r--r--pk/vm.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/pk/vm.h b/pk/vm.h
new file mode 100644
index 0000000..349d9ef
--- /dev/null
+++ b/pk/vm.h
@@ -0,0 +1,26 @@
+#ifndef _VM_H
+#define _VM_H
+
+#include "syscall.h"
+#include "file.h"
+#include <string.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+#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
+
+void vm_init();
+int handle_page_fault(uintptr_t vaddr, int prot);
+void populate_mapping(const void* start, size_t size, int prot);
+uintptr_t __do_mmap(uintptr_t addr, size_t length, int prot, int flags, file_t* file, off_t offset);
+sysret_t do_mmap(uintptr_t addr, size_t length, int prot, int flags, int fd, off_t offset);
+sysret_t do_brk(uintptr_t addr);
+
+#endif