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.


c325085c5b380c61507084955b2226e6dd1be070
[palacios.git] / palacios / include / palacios / vmm_debug.h
1 /*
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
11  * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20
21 #ifndef __VMM_DEBUG_H__
22 #define __VMM_DEBUG_H__
23
24
25 #ifdef __V3VEE__
26
27 #include <palacios/vmm.h>
28 #include <palacios/vmm_regs.h>
29
30 #define NUM_IDT_ENTRIES 256
31 #define NUM_GDT_ENTRIES 16
32
33 struct segment_selector {
34     uint8_t  rpl        :  2;
35     uint8_t  ti         :  1;
36     uint16_t index      : 13;
37 }__attribute__((packed));
38
39 struct int_trap_gate_long {
40     uint16_t offset_lo  : 16;
41     uint16_t selector   : 16;
42     uint8_t  ist        :  3;
43     uint8_t  ign        :  5;
44     uint8_t  type       :  4;
45     uint8_t  s          :  1;
46     uint8_t  dpl        :  2;
47     uint8_t  p          :  1;
48     uint16_t offset_mid : 16;
49     uint32_t offset_hi  : 32;
50     uint32_t ign2       : 32;
51 }__attribute__((packed));
52
53 struct call_gate_long {
54     uint16_t offset_lo  : 16;
55     uint16_t selector   : 16;
56     uint8_t  ign        :  8;
57     uint8_t  type       :  4;
58     uint8_t  s          :  1;
59     uint8_t  dpl        :  2;
60     uint8_t  p          :  1;
61     uint16_t offset_mid : 16;
62     uint32_t offset_hi  : 32;
63     uint8_t  ign2       :  8;
64     uint8_t  count      :  5;
65     uint32_t ign3       : 19;
66 }__attribute__((packed));
67
68 struct system_desc_long {
69     uint16_t limit_lo   : 16;
70     uint16_t base_lo    : 16;
71     uint8_t  base_mid1  :  8;
72     uint8_t  type       :  4;
73     uint8_t  s          :  1;
74     uint8_t  dpl        :  2;
75     uint8_t  p          :  1;
76     uint8_t  limit_hi   :  4;
77     uint8_t  avl        :  1;
78     uint8_t  ign        :  2;
79     uint8_t  g          :  1;
80     uint8_t  base_mid2  :  8;
81     uint32_t base_hi    : 32;
82     uint8_t  ign2       :  8;
83     uint8_t  lgcy_type  :  5;
84     uint32_t ign3       : 19;
85 }__attribute__((packed));
86
87 struct data_desc_long {
88     uint16_t limit_lo   : 16;
89     uint16_t base_lo    : 16;
90     uint8_t  base_mid   :  8;
91     uint8_t  a          :  1;
92     uint8_t  w          :  1;
93     uint8_t  e          :  1;
94     uint8_t  zero       :  1;
95     uint8_t  one        :  1;
96     uint8_t  dpl        :  2;
97     uint8_t  p          :  1;
98     uint8_t  limit_hi   :  4;
99     uint8_t  avl        :  1;
100     uint8_t  ign        :  1;
101     uint8_t  db         :  1;
102     uint8_t  g          :  1;
103     uint8_t  base_hi    :  8;
104 }__attribute__((packed));
105
106 struct code_desc_long {
107     uint16_t limit_lo   : 16;
108     uint16_t base_lo    : 16;
109     uint8_t  base_mid   :  8;
110     uint8_t  a          :  1;
111     uint8_t  r          :  1;
112     uint8_t  c          :  1;
113     uint8_t  one1       :  1;
114     uint8_t  one2       :  1;
115     uint8_t  dpl        :  2;
116     uint8_t  p          :  1;
117     uint8_t  limit_hi   :  4;
118     uint8_t  avl        :  1;
119     uint8_t  l          :  1;
120     uint8_t  d          :  1;
121     uint8_t  g          :  1;
122     uint8_t  base_hi    :  8;
123 }__attribute__((packed));
124
125 struct int_trap_gate_lgcy {
126     uint16_t offset_lo  : 16;
127     uint16_t selector   : 16;
128     uint8_t  ign        :  8;
129     uint8_t  type       :  4;
130     uint8_t  s          :  1;
131     uint8_t  dpl        :  2;
132     uint8_t  p          :  1;
133     uint16_t offset_hi  : 16;
134 }__attribute__((packed));
135
136 struct call_gate_lgcy {
137     uint16_t offset_lo  : 16;
138     uint16_t selector   : 16;
139     uint8_t  count      :  4;
140     uint8_t  ign        :  4;
141     uint8_t  type       :  4;
142     uint8_t  s          :  1;
143     uint8_t  dpl        :  2;
144     uint8_t  p          :  1;
145     uint16_t offset_hi  : 16;
146 }__attribute__((packed));
147
148 struct trap_gate_lgcy {
149     uint16_t ign        : 16;
150     uint16_t selector   : 16;
151     uint8_t  ign2       :  8;
152     uint8_t  type       :  4;
153     uint8_t  s          :  1;
154     uint8_t  dpl        :  2;
155     uint8_t  p          :  1;
156     uint16_t ign3       : 16;
157 }__attribute__((packed));
158
159 struct system_desc_lgcy {
160     uint16_t limit_lo   : 16;
161     uint16_t base_lo    : 16;
162     uint8_t  base_mid   :  8;
163     uint8_t  type       :  4;
164     uint8_t  s          :  1;
165     uint8_t  dpl        :  2;
166     uint8_t  p          :  1;
167     uint8_t  limit_hi   :  4;
168     uint8_t  avl        :  1;
169     uint8_t  ign        :  2;
170     uint8_t  g          :  1;
171     uint8_t  base_hi    :  8;
172 }__attribute__((packed));
173
174 struct data_desc_lgcy {
175     uint16_t limit_lo   : 16;
176     uint16_t base_lo    : 16;
177     uint8_t  base_mid   :  8;
178     uint8_t  type       :  4;
179     uint8_t  s          :  1;
180     uint8_t  dpl        :  2;
181     uint8_t  p          :  1;
182     uint8_t  limit_hi   :  4;
183     uint8_t  avl        :  1;
184     uint8_t  ign        :  1;
185     uint8_t  db         :  1;
186     uint8_t  g          :  1;
187     uint8_t  base_hi    :  8;
188 }__attribute__((packed));
189
190 struct code_desc_lgcy {
191     uint16_t limit_lo   : 16;
192     uint16_t base_lo    : 16;
193     uint8_t  base_mid   :  8;
194     uint8_t  type       :  4;
195     uint8_t  s          :  1;
196     uint8_t  dpl        :  2;
197     uint8_t  p          :  1;
198     uint8_t  limit_hi   :  4;
199     uint8_t  avl        :  1;
200     uint8_t  ign        :  1;
201     uint8_t  d          :  1;
202     uint8_t  g          :  1;
203     uint8_t  base_hi    :  8;
204 }__attribute__((packed));
205         
206
207 struct selector_error_code {
208     uint8_t  ext        :  1;
209     uint8_t  idt        :  1;
210     uint8_t  ti         :  1;
211     uint16_t index      : 13;
212     uint16_t ign        : 16;
213 }__attribute__((packed));
214
215
216 int v3_init_vm_debugging(struct v3_vm_info * vm);
217
218 void v3_print_guest_state(struct guest_info * core);
219 void v3_print_arch_state(struct guest_info * core);
220
221 void v3_print_segments(struct v3_segments * segs);
222 void v3_print_ctrl_regs(struct guest_info * core);
223 void v3_print_GPRs(struct guest_info * core);
224
225 void v3_print_backtrace(struct guest_info * core);
226 void v3_print_stack(struct guest_info * core);
227 void v3_print_guest_state_all(struct v3_vm_info * vm);
228
229 void v3_print_idt(struct guest_info * core, addr_t idtr_base);
230 void v3_print_gdt(struct guest_info * core, addr_t gdtr_base);
231 void v3_print_gp_error(struct guest_info * core, addr_t exit_info1);
232
233 #endif // !__V3VEE__
234
235 #endif