diff options
Diffstat (limited to 'mem/vmap.h')
| -rw-r--r-- | mem/vmap.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mem/vmap.h b/mem/vmap.h new file mode 100644 index 0000000..4e1816c --- /dev/null +++ b/mem/vmap.h @@ -0,0 +1,31 @@ +#ifndef MEM_VMAP_H +#define MEM_VMAP_H + +#include <rt.h> + +typedef struct mem_vmap MemVmap; + +typedef usize (*MemVmapTranslate)(MemVmap *, usize); +typedef int (*MemVmapMap)(MemVmap *, usize, usize, usize, int); +typedef int (*MemVmapUnmap)(MemVmap *, usize, usize); +typedef void (*MemVmapSwitchTo)(MemVmap *); + +/* Structure abstracting the memory mapping facilities of + the machine */ +struct mem_vmap { + MemVmapTranslate translate; + MemVmapMap map; + MemVmapUnmap unmap; + MemVmapSwitchTo switch_to; + + /* Flag indicating whether the previous translation + lead to a miss */ + int miss; +}; + +usize mem_vmap_translate(MemVmap *inner, usize virt); +int mem_vmap_map(MemVmap *inner, usize phys, usize virt, usize len, int flags); +void mem_vmap_unmap(MemVmap *inner, usize virt, usize len); +void mem_vmap_switch_to(MemVmap *inner); + +#endif
\ No newline at end of file |
