Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Added memory ranges
[palacios.git] / palacios / include / geekos / vmm_mem.h
1 #ifndef __VMM_MEM_H
2 #define __VMM_MEM_H
3
4
5 #include <geekos/ktypes.h>
6
7
8
9
10 typedef struct mem_region {
11   ullong_t addr;
12   uint_t num_pages;
13
14   struct mem_region * next;
15   struct mem_region * prev;
16 } mem_region_t;
17
18
19 typedef struct vmm_mem_list {
20   uint_t num_pages;
21   bool long_mode;
22
23   uint_t num_regions;
24   mem_region_t * head;
25   //  mem_region_t * tail;
26 } vmm_mem_list_t;
27
28
29
30 /** Memory layout **/
31 /* Describes the layout of memory for the guest */
32 /* We use this to build the guest page tables */
33
34 typedef enum region_type {GUEST, UNMAPPED, SHARED} region_type_t;
35
36
37 typedef struct layout_region {
38   ullong_t addr;
39   uint_t num_pages;
40
41   region_type_t type;
42
43   ullong_t host_addr;
44
45   struct layout_region * next;
46   struct layout_region * prev;
47   
48
49 } layout_region_t;
50
51
52 typedef struct vmm_mem_layout {
53   uint_t num_pages;
54   uint_t num_regions;
55
56   layout_region_t * head;
57   //layout_region_t * tail;
58
59 } vmm_mem_layout_t;
60
61
62 /*** FOR THE LOVE OF GOD WRITE SOME UNIT TESTS FOR THIS THING ***/
63
64 void init_mem_list(vmm_mem_list_t * list);
65 void free_mem_list(vmm_mem_list_t * list);
66
67 int add_mem_list_pages(vmm_mem_list_t * list, ullong_t addr, uint_t num_pages);
68 int remove_mem_list_pages(vmm_mem_list_t * list, ullong_t addr, uint_t num_pages);
69
70 mem_region_t * get_mem_list_cursor(vmm_mem_list_t * list, ullong_t addr);
71
72
73
74 void init_mem_laout(vmm_mem_layout_t * layout);
75 void free_mem_layout(vmm_mem_layout_t * layout);
76
77 layout_region_t * get_layout_cursor(vmm_mem_layout_t * layout, ullong_t addr);
78
79 int add_mem_range(vmm_mem_layout_t * layout, layout_region_t * region);
80 int add_shared_mem_range(vmm_mem_layout_t * layout, ullong_t addr, uint_t num_pages, ullong_t host_addr);
81 int add_unmapped_mem_range(vmm_mem_layout_t * layout, ullong_t addr, uint_t num_pages);
82 int add_guest_mem_range(vmm_mem_layout_t * layout, ullong_t addr, uint_t num_pages);
83
84 #endif