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.


initial SVM guest running
[palacios.git] / palacios / include / geekos / vmm.h
1 #ifndef __VMM_H
2 #define __VMM_H
3
4
5 #include <geekos/ktypes.h>
6 #include <geekos/string.h>
7
8 #include <geekos/vmm_mem.h>
9
10
11 /* utility definitions */
12 #define PrintDebug(fmt, args...)                        \
13   do {                                                  \
14     extern struct vmm_os_hooks * os_hooks;              \
15     if ((os_hooks) && (os_hooks)->print_debug) {        \
16       (os_hooks)->print_debug((fmt), ##args);           \
17     }                                                   \
18   } while (0)                                           \
19
20
21
22 #define PrintInfo(fmt, args...)                         \
23   do {                                                  \
24     extern struct vmm_os_hooks * os_hooks;              \
25     if ((os_hooks) && (os_hooks)->print_info) {         \
26       (os_hooks)->print_info((fmt), ##args);            \
27     }                                                   \
28   } while (0)                                           \
29
30
31 #define PrintTrace(fmt, args...)                        \
32   do {                                                  \
33     extern struct vmm_os_hooks * os_hooks;              \
34     if ((os_hooks) && (os_hooks)->print_trace) {        \
35       (os_hooks)->print_trace((fmt), ##args);           \
36     }                                                   \
37   } while (0)                                           \
38
39
40 /* ** */
41
42
43 #define VMM_INVALID_CPU 0
44 #define VMM_VMX_CPU 1
45 #define VMM_SVM_CPU 2
46
47
48
49 typedef struct guest_info {
50   ullong_t rip;
51   ullong_t rsp;
52
53   vmm_mem_map_t mem_map;
54   // preallocation map
55   // device_map
56
57   void * vmm_data;
58 } guest_info_t;
59
60
61
62 /* We need a memory map and an IO device map */
63
64 /* This will contain function pointers that provide OS services */
65 struct vmm_os_hooks {
66   void (*print_info)(const char * format, ...);
67   void (*print_debug)(const char * format, ...);
68   void (*print_trace)(const char * format, ...);
69   
70   void *(*Allocate_Pages)(int numPages);
71   void (*Free_Page)(void * page);
72
73   void *(*malloc)(uint_t size);
74   void (*free)(void * addr);
75
76
77   void (*start_kernel_thread)(); // include pointer to function
78 };
79
80
81
82
83 /* This will contain Function pointers that control the VMs */
84 struct vmm_ctrl_ops {
85   int (*init_guest)(struct guest_info* info);
86   int (*start_guest)(struct guest_info * info);
87   //  int (*stop_vm)(uint_t vm_id);
88 };
89
90
91
92
93
94
95
96 void Init_VMM(struct vmm_os_hooks * hooks, struct vmm_ctrl_ops * vmm_ops);
97
98
99
100
101
102 #endif