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.


changed the emulator to use single step break points instead of page insertion
[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 #include <palacios/vmm_emulator.h>
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   v3_reg_t efer;
40 };
41
42
43
44 struct v3_dbg_regs {
45   v3_reg_t dr0;
46   v3_reg_t dr1;
47   v3_reg_t dr2;
48   v3_reg_t dr3;
49   v3_reg_t dr6;
50   v3_reg_t dr7;
51 };
52
53 struct v3_segment {
54   ushort_t selector;
55   uint_t limit;
56   ullong_t base;
57   uint_t type           : 4;
58   uint_t system         : 1;
59   uint_t dpl            : 2;
60   uint_t present        : 1;
61   uint_t avail          : 1;
62   uint_t long_mode      : 1;
63   uint_t db             : 1;
64   uint_t granularity    : 1;
65 };
66
67
68 struct v3_segments {
69   struct v3_segment cs;
70   struct v3_segment ds;
71   struct v3_segment es;
72   struct v3_segment fs;
73   struct v3_segment gs;
74   struct v3_segment ss;
75   struct v3_segment ldtr;
76   struct v3_segment gdtr;
77   struct v3_segment idtr;
78   struct v3_segment tr;
79 };
80
81 struct shadow_page_state;
82 struct shadow_map;
83 struct vmm_io_map;
84 struct emulation_state;
85
86
87 struct vm_ctrl_ops {
88   int (*raise_irq)(struct guest_info * info, int irq);
89 };
90
91
92
93
94
95 typedef enum {SHADOW_PAGING, NESTED_PAGING} vmm_paging_mode_t;
96 typedef enum {VM_RUNNING, VM_STOPPED, VM_SUSPENDED, VM_ERROR, VM_EMULATING} vm_operating_mode_t;
97
98
99 typedef enum {REAL, /*UNREAL,*/ PROTECTED, PROTECTED_PAE, LONG, LONG_32_COMPAT, LONG_16_COMPAT} vm_cpu_mode_t;
100 typedef enum {PHYSICAL_MEM, VIRTUAL_MEM} vm_mem_mode_t;
101
102
103
104 struct guest_info {
105   ullong_t rip;
106
107   uint_t cpl;
108
109   struct shadow_map mem_map;
110
111   struct vm_time time_state;
112   
113   vmm_paging_mode_t shdw_pg_mode;
114   struct shadow_page_state shdw_pg_state;
115   addr_t direct_map_pt;
116   // nested_paging_t nested_page_state;
117
118
119   // This structure is how we get interrupts for the guest
120   struct vm_intr intr_state;
121
122   struct vmm_io_map io_map;
123   // device_map
124
125   struct vmm_dev_mgr  dev_mgr;
126
127   vm_cpu_mode_t cpu_mode;
128   vm_mem_mode_t mem_mode;
129
130
131   struct v3_gprs vm_regs;
132   struct v3_ctrl_regs ctrl_regs;
133   struct v3_dbg_regs dbg_regs;
134   struct v3_segments segments;
135
136   struct vm_ctrl_ops vm_ops;
137
138   struct emulation_state emulator;
139
140   vm_operating_mode_t run_state;
141   void * vmm_data;
142 };
143
144
145 vm_cpu_mode_t get_cpu_mode(struct guest_info * info);
146 vm_mem_mode_t get_mem_mode(struct guest_info * info);
147
148
149 void PrintV3Segments(struct guest_info * info);
150 void PrintV3CtrlRegs(struct guest_info * info);
151 void PrintV3GPRs(struct guest_info * info);
152
153 #endif
154
155
156
157 #endif