kern
diff src/vm.h @ 68:0a205396e1a0
- added a generic red-black tree data structure
- added a VM map as an red-black tree of vm_pages in the process structure
- constructed the vm map of the memory passed by the kernel initially to the first process.
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Mon, 10 Oct 2011 04:16:01 +0300 |
parents | 437360696883 |
children | b45e2d5f0ae1 |
line diff
1.1 --- a/src/vm.h Sun Oct 09 20:38:35 2011 +0300 1.2 +++ b/src/vm.h Mon Oct 10 04:16:01 2011 +0300 1.3 @@ -3,8 +3,10 @@ 1.4 1.5 #include <stdlib.h> 1.6 #include "mboot.h" 1.7 +#include "rbtree.h" 1.8 1.9 #define KMEM_START 0xc0000000 1.10 +#define KMEM_START_PAGE ADDR_TO_PAGE(KMEM_START) 1.11 1.12 /* page mapping flags */ 1.13 #define PG_PRESENT (1 << 0) 1.14 @@ -44,6 +46,13 @@ 1.15 #define PAGE_ONLY 0 1.16 #define WHOLE_PATH 1 1.17 1.18 +struct vm_page { 1.19 + int vpage, ppage; 1.20 + unsigned int flags; 1.21 + 1.22 + int nref; 1.23 +}; 1.24 + 1.25 void init_vm(void); 1.26 1.27 int map_page(int vpage, int ppage, unsigned int attr); 1.28 @@ -70,6 +79,9 @@ 1.29 void set_page_bit(int pgnum, uint32_t bit, int wholepath); 1.30 void clear_page_bit(int pgnum, uint32_t bit, int wholepath); 1.31 1.32 +/* construct the vm map for the current user mappings */ 1.33 +int cons_vmmap(struct rbtree *vmmap); 1.34 + 1.35 void dbg_print_vm(int area); 1.36 1.37 /* defined in vm-asm.S */