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.


moved xed around to setup the decoder interface
[palacios.git] / palacios / include / palacios / vm_guest.h
1 #ifndef __VM_GUEST_H
2 #define __VM_GUEST_H
3
4 #ifdef __V3VEE__
5
6
7 #include <palacios/vmm_mem.h>
8 #include <palacios/vmm_types.h>
9 #include <palacios/vmm_io.h>
10 #include <palacios/vmm_shadow_paging.h>
11 #include <palacios/vmm_intr.h>
12 #include <palacios/vmm_dev_mgr.h>
13 #include <palacios/vmm_time.h>
14
15
16 typedef ullong_t v3_reg_t;
17
18
19
20 struct v3_gprs {
21   v3_reg_t rdi;
22   v3_reg_t rsi;
23   v3_reg_t rbp;
24   v3_reg_t rsp;
25   v3_reg_t rbx;
26   v3_reg_t rdx;
27   v3_reg_t rcx;
28   v3_reg_t rax;
29 };
30
31
32 struct v3_ctrl_regs {
33   v3_reg_t cr0;
34   v3_reg_t cr2;
35   v3_reg_t cr3;
36   v3_reg_t cr4;
37   v3_reg_t cr8;
38   v3_reg_t rflags;
39 };
40
41
42 struct v3_segment {
43   ushort_t selector;
44   uint_t limit;
45   ullong_t base;
46   uint_t type           : 4;
47   uint_t system         : 1;
48   uint_t dpl            : 2;
49   uint_t present        : 1;
50   uint_t avail          : 1;
51   uint_t long_mode      : 1;
52   uint_t db             : 1;
53   uint_t granularity    : 1;
54 };
55
56
57 struct v3_segments {
58   struct v3_segment cs;
59   struct v3_segment ds;
60   struct v3_segment es;
61   struct v3_segment fs;
62   struct v3_segment gs;
63   struct v3_segment ss;
64   struct v3_segment ldtr;
65   struct v3_segment gdtr;
66   struct v3_segment idtr;
67   struct v3_segment tr;
68 };
69
70 struct shadow_page_state;
71 struct shadow_map;
72 struct vmm_io_map;
73
74
75 struct vm_ctrl_ops {
76   int (*raise_irq)(struct guest_info * info, int irq);
77 };
78
79
80
81
82
83 typedef enum {SHADOW_PAGING, NESTED_PAGING} vmm_paging_mode_t;
84 typedef enum {REAL, /*UNREAL,*/ PROTECTED, PROTECTED_PAE, LONG} vm_cpu_mode_t;
85 typedef enum {PHYSICAL_MEM, VIRTUAL_MEM} vm_mem_mode_t;
86
87 struct guest_info {
88   ullong_t rip;
89
90   uint_t cpl;
91
92   struct shadow_map mem_map;
93
94   struct vm_time time_state;
95   
96   vmm_paging_mode_t shdw_pg_mode;
97   struct shadow_page_state shdw_pg_state;
98   addr_t direct_map_pt;
99   // nested_paging_t nested_page_state;
100
101
102   // This structure is how we get interrupts for the guest
103   struct vm_intr intr_state;
104
105   struct vmm_io_map io_map;
106   // device_map
107
108   struct vmm_dev_mgr  dev_mgr;
109
110   vm_cpu_mode_t cpu_mode;
111   vm_mem_mode_t mem_mode;
112
113
114   struct v3_gprs vm_regs;
115   struct v3_ctrl_regs ctrl_regs;
116   struct v3_segments segments;
117
118   struct vm_ctrl_ops vm_ops;
119
120
121
122   void * vmm_data;
123 };
124
125
126 void PrintV3Segments(struct guest_info * info);
127 void PrintV3CtrlRegs(struct guest_info * info);
128 void PrintV3GPRs(struct guest_info * info);
129
130 #endif
131
132
133
134 #endif