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.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
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.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #include <palacios/vmcb.h>
21 #include <palacios/vmm.h>
22 #include <palacios/vmm_util.h>
26 void set_vmcb_segment(struct vmcb_selector * vmcb_seg, struct v3_segment * seg) {
27 vmcb_seg->selector = seg->selector;
28 vmcb_seg->limit = seg->limit;
29 vmcb_seg->base = seg->base;
30 vmcb_seg->attrib.fields.type = seg->type;
31 vmcb_seg->attrib.fields.S = seg->system;
32 vmcb_seg->attrib.fields.dpl = seg->dpl;
33 vmcb_seg->attrib.fields.P = seg->present;
34 vmcb_seg->attrib.fields.avl = seg->avail;
35 vmcb_seg->attrib.fields.L = seg->long_mode;
36 vmcb_seg->attrib.fields.db = seg->db;
37 vmcb_seg->attrib.fields.G = seg->granularity;
41 void get_vmcb_segment(struct vmcb_selector * vmcb_seg, struct v3_segment * seg) {
42 seg->selector = vmcb_seg->selector;
43 seg->limit = vmcb_seg->limit;
44 seg->base = vmcb_seg->base;
45 seg->type = vmcb_seg->attrib.fields.type;
46 seg->system = vmcb_seg->attrib.fields.S;
47 seg->dpl = vmcb_seg->attrib.fields.dpl;
48 seg->present = vmcb_seg->attrib.fields.P;
49 seg->avail = vmcb_seg->attrib.fields.avl;
50 seg->long_mode = vmcb_seg->attrib.fields.L;
51 seg->db = vmcb_seg->attrib.fields.db;
52 seg->granularity = vmcb_seg->attrib.fields.G;
56 void set_vmcb_segments(vmcb_t * vmcb, struct v3_segments * segs) {
57 vmcb_saved_state_t * guest_area = GET_VMCB_SAVE_STATE_AREA(vmcb);
59 set_vmcb_segment(&(guest_area->cs), &(segs->cs));
60 set_vmcb_segment(&(guest_area->ds), &(segs->ds));
61 set_vmcb_segment(&(guest_area->es), &(segs->es));
62 set_vmcb_segment(&(guest_area->fs), &(segs->fs));
63 set_vmcb_segment(&(guest_area->gs), &(segs->gs));
64 set_vmcb_segment(&(guest_area->ss), &(segs->ss));
65 set_vmcb_segment(&(guest_area->ldtr), &(segs->ldtr));
66 set_vmcb_segment(&(guest_area->gdtr), &(segs->gdtr));
67 set_vmcb_segment(&(guest_area->idtr), &(segs->idtr));
68 set_vmcb_segment(&(guest_area->tr), &(segs->tr));
72 void get_vmcb_segments(vmcb_t * vmcb, struct v3_segments * segs) {
73 vmcb_saved_state_t * guest_area = GET_VMCB_SAVE_STATE_AREA(vmcb);
75 get_vmcb_segment(&(guest_area->cs), &(segs->cs));
76 get_vmcb_segment(&(guest_area->ds), &(segs->ds));
77 get_vmcb_segment(&(guest_area->es), &(segs->es));
78 get_vmcb_segment(&(guest_area->fs), &(segs->fs));
79 get_vmcb_segment(&(guest_area->gs), &(segs->gs));
80 get_vmcb_segment(&(guest_area->ss), &(segs->ss));
81 get_vmcb_segment(&(guest_area->ldtr), &(segs->ldtr));
82 get_vmcb_segment(&(guest_area->gdtr), &(segs->gdtr));
83 get_vmcb_segment(&(guest_area->idtr), &(segs->idtr));
84 get_vmcb_segment(&(guest_area->tr), &(segs->tr));
88 void PrintDebugVMCB(vmcb_t * vmcb) {
91 vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA(vmcb);
92 vmcb_saved_state_t * guest_area = GET_VMCB_SAVE_STATE_AREA(vmcb);
94 PrintDebug("VMCB (0x%p)\n", (void *)vmcb);
96 PrintDebug("--Control Area--\n");
97 PrintDebug("CR Reads: %x\n", *(ushort_t*)&(ctrl_area->cr_reads));
98 PrintDebug("CR Writes: %x\n", *(ushort_t*)&(ctrl_area->cr_writes));
99 PrintDebug("DR Reads: %x\n", *(ushort_t*)&(ctrl_area->dr_reads));
100 PrintDebug("DR Writes: %x\n", *(ushort_t*)&(ctrl_area->dr_writes));
102 PrintDebug("Exception Bitmap: %x (at 0x%p)\n", *(uint_t*)&(ctrl_area->exceptions), (void *)&(ctrl_area->exceptions));
103 PrintDebug("\tDivide-by-Zero: %d\n", ctrl_area->exceptions.de);
104 PrintDebug("\tDebug: %d\n", ctrl_area->exceptions.db);
105 PrintDebug("\tNon-maskable interrupts: %d\n", ctrl_area->exceptions.nmi);
106 PrintDebug("\tBreakpoint: %d\n", ctrl_area->exceptions.bp);
107 PrintDebug("\tOverflow: %d\n", ctrl_area->exceptions.of);
108 PrintDebug("\tBound-Range: %d\n", ctrl_area->exceptions.br);
109 PrintDebug("\tInvalid Opcode: %d\n", ctrl_area->exceptions.ud);
110 PrintDebug("\tDevice not available: %d\n", ctrl_area->exceptions.nm);
111 PrintDebug("\tDouble Fault: %d\n", ctrl_area->exceptions.df);
112 PrintDebug("\tInvalid TSS: %d\n", ctrl_area->exceptions.ts);
113 PrintDebug("\tSegment not present: %d\n", ctrl_area->exceptions.np);
114 PrintDebug("\tStack: %d\n", ctrl_area->exceptions.ss);
115 PrintDebug("\tGPF: %d\n", ctrl_area->exceptions.gp);
116 PrintDebug("\tPage Fault: %d\n", ctrl_area->exceptions.pf);
117 PrintDebug("\tFloating Point: %d\n", ctrl_area->exceptions.mf);
118 PrintDebug("\tAlignment Check: %d\n", ctrl_area->exceptions.ac);
119 PrintDebug("\tMachine Check: %d\n", ctrl_area->exceptions.mc);
120 PrintDebug("\tSIMD floating point: %d\n", ctrl_area->exceptions.xf);
121 PrintDebug("\tSecurity: %d\n", ctrl_area->exceptions.sx);
123 PrintDebug("Instructions bitmap: %.8x (at 0x%p)\n", *(uint_t*)&(ctrl_area->instrs), &(ctrl_area->instrs));
124 PrintDebug("\tINTR: %d\n", ctrl_area->instrs.INTR);
125 PrintDebug("\tNMI: %d\n", ctrl_area->instrs.NMI);
126 PrintDebug("\tSMI: %d\n", ctrl_area->instrs.SMI);
127 PrintDebug("\tINIT: %d\n", ctrl_area->instrs.INIT);
128 PrintDebug("\tVINTR: %d\n", ctrl_area->instrs.VINTR);
129 PrintDebug("\tCR0: %d\n", ctrl_area->instrs.CR0);
130 PrintDebug("\tRD_IDTR: %d\n", ctrl_area->instrs.RD_IDTR);
131 PrintDebug("\tRD_GDTR: %d\n", ctrl_area->instrs.RD_GDTR);
132 PrintDebug("\tRD_LDTR: %d\n", ctrl_area->instrs.RD_LDTR);
133 PrintDebug("\tRD_TR: %d\n", ctrl_area->instrs.RD_TR);
134 PrintDebug("\tWR_IDTR: %d\n", ctrl_area->instrs.WR_IDTR);
135 PrintDebug("\tWR_GDTR: %d\n", ctrl_area->instrs.WR_GDTR);
136 PrintDebug("\tWR_LDTR: %d\n", ctrl_area->instrs.WR_LDTR);
137 PrintDebug("\tWR_TR: %d\n", ctrl_area->instrs.WR_TR);
138 PrintDebug("\tRDTSC: %d\n", ctrl_area->instrs.RDTSC);
139 PrintDebug("\tRDPMC: %d\n", ctrl_area->instrs.RDPMC);
140 PrintDebug("\tPUSHF: %d\n", ctrl_area->instrs.PUSHF);
141 PrintDebug("\tPOPF: %d\n", ctrl_area->instrs.POPF);
142 PrintDebug("\tCPUID: %d\n", ctrl_area->instrs.CPUID);
143 PrintDebug("\tRSM: %d\n", ctrl_area->instrs.RSM);
144 PrintDebug("\tIRET: %d\n", ctrl_area->instrs.IRET);
145 PrintDebug("\tINTn: %d\n", ctrl_area->instrs.INTn);
146 PrintDebug("\tINVD: %d\n", ctrl_area->instrs.INVD);
147 PrintDebug("\tPAUSE: %d\n", ctrl_area->instrs.PAUSE);
148 PrintDebug("\tHLT: %d\n", ctrl_area->instrs.HLT);
149 PrintDebug("\tINVLPG: %d\n", ctrl_area->instrs.INVLPG);
150 PrintDebug("\tINVLPGA: %d\n", ctrl_area->instrs.INVLPGA);
151 PrintDebug("\tIOIO_PROT: %d\n", ctrl_area->instrs.IOIO_PROT);
152 PrintDebug("\tMSR_PROT: %d\n", ctrl_area->instrs.MSR_PROT);
153 PrintDebug("\ttask_switch: %d\n", ctrl_area->instrs.task_switch);
154 PrintDebug("\tFERR_FREEZE: %d\n", ctrl_area->instrs.FERR_FREEZE);
155 PrintDebug("\tshutdown_evts: %d\n", ctrl_area->instrs.shutdown_evts);
157 PrintDebug("SVM Instruction Bitmap: %x (at 0x%p)\n", *(uint_t*)&(ctrl_area->svm_instrs), &(ctrl_area->svm_instrs));
158 PrintDebug("\tVMRUN: %d\n", ctrl_area->svm_instrs.VMRUN);
159 PrintDebug("\tVMMCALL: %d\n", ctrl_area->svm_instrs.VMMCALL);
160 PrintDebug("\tVMLOAD: %d\n", ctrl_area->svm_instrs.VMLOAD);
161 PrintDebug("\tVMSAVE: %d\n", ctrl_area->svm_instrs.VMSAVE);
162 PrintDebug("\tSTGI: %d\n", ctrl_area->svm_instrs.STGI);
163 PrintDebug("\tCLGI: %d\n", ctrl_area->svm_instrs.CLGI);
164 PrintDebug("\tSKINIT: %d\n", ctrl_area->svm_instrs.SKINIT);
165 PrintDebug("\tRDTSCP: %d\n", ctrl_area->svm_instrs.RDTSCP);
166 PrintDebug("\tICEBP: %d\n", ctrl_area->svm_instrs.ICEBP);
167 PrintDebug("\tWBINVD: %d\n", ctrl_area->svm_instrs.WBINVD);
168 PrintDebug("\tMONITOR: %d\n", ctrl_area->svm_instrs.MONITOR);
169 PrintDebug("\tMWAIT_always: %d\n", ctrl_area->svm_instrs.MWAIT_always);
170 PrintDebug("\tMWAIT_if_armed: %d\n", ctrl_area->svm_instrs.MWAIT_if_armed);
174 tmp_reg.r_reg = ctrl_area->IOPM_BASE_PA;
175 PrintDebug("IOPM_BASE_PA: lo: 0x%x, hi: 0x%x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high);
176 tmp_reg.r_reg = ctrl_area->MSRPM_BASE_PA;
177 PrintDebug("MSRPM_BASE_PA: lo: 0x%x, hi: 0x%x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high);
178 tmp_reg.r_reg = ctrl_area->TSC_OFFSET;
179 PrintDebug("TSC_OFFSET: lo: 0x%x, hi: 0x%x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high);
181 PrintDebug("guest_ASID: %d\n", ctrl_area->guest_ASID);
182 PrintDebug("TLB_CONTROL: %d\n", ctrl_area->TLB_CONTROL);
185 PrintDebug("Guest Control Bitmap: %x (at 0x%p)\n", *(uint_t*)&(ctrl_area->guest_ctrl), &(ctrl_area->guest_ctrl));
186 PrintDebug("\tV_TPR: %d\n", ctrl_area->guest_ctrl.V_TPR);
187 PrintDebug("\tV_IRQ: %d\n", ctrl_area->guest_ctrl.V_IRQ);
188 PrintDebug("\tV_INTR_PRIO: %d\n", ctrl_area->guest_ctrl.V_INTR_PRIO);
189 PrintDebug("\tV_IGN_TPR: %d\n", ctrl_area->guest_ctrl.V_IGN_TPR);
190 PrintDebug("\tV_INTR_MASKING: %d\n", ctrl_area->guest_ctrl.V_INTR_MASKING);
191 PrintDebug("\tV_INTR_VECTOR: %d\n", ctrl_area->guest_ctrl.V_INTR_VECTOR);
193 PrintDebug("Interrupt_shadow: %d\n", ctrl_area->interrupt_shadow);
196 tmp_reg.r_reg = ctrl_area->exit_code;
197 PrintDebug("exit_code: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
198 tmp_reg.r_reg = ctrl_area->exit_info1;
199 PrintDebug("exit_info1: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
200 tmp_reg.r_reg = ctrl_area->exit_info2;
201 PrintDebug("exit_info2: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
204 PrintDebug("Exit Int Info: (at 0x%p)\n", &(ctrl_area->exit_int_info));
205 PrintDebug("Vector: %d\n", ctrl_area->exit_int_info.vector);
206 PrintDebug("(type=%d) (ev=%d) (valid=%d)\n", ctrl_area->exit_int_info.type,
207 ctrl_area->exit_int_info.ev, ctrl_area->exit_int_info.valid);
208 PrintDebug("Error Code: %d\n", ctrl_area->exit_int_info.error_code);
211 tmp_reg.r_reg = ctrl_area->NP_ENABLE;
212 PrintDebug("NP_ENABLE: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
214 PrintDebug("Event Injection: (at 0x%p)\n", &(ctrl_area->EVENTINJ));
215 PrintDebug("Vector: %d\n", ctrl_area->EVENTINJ.vector);
216 PrintDebug("(type=%d) (ev=%d) (valid=%d)\n", ctrl_area->EVENTINJ.type,
217 ctrl_area->EVENTINJ.ev, ctrl_area->EVENTINJ.valid);
218 PrintDebug("Error Code: %d\n", ctrl_area->EVENTINJ.error_code);
221 tmp_reg.r_reg = ctrl_area->N_CR3;
222 PrintDebug("N_CR3: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
224 PrintDebug("LBR_VIRTUALIZATION_ENABLE: %d\n", ctrl_area->LBR_VIRTUALIZATION_ENABLE);
227 PrintDebug("\n--Guest Saved State--\n");
229 PrintDebug("es Selector (at 0x%p): \n", &(guest_area->es));
230 PrintDebug("\tSelector: %d\n", guest_area->es.selector);
231 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
232 guest_area->es.attrib.fields.type, guest_area->es.attrib.fields.S,
233 guest_area->es.attrib.fields.dpl, guest_area->es.attrib.fields.P,
234 guest_area->es.attrib.fields.avl, guest_area->es.attrib.fields.L,
235 guest_area->es.attrib.fields.db, guest_area->es.attrib.fields.G);
236 PrintDebug("\tlimit: %u\n", guest_area->es.limit);
237 tmp_reg.r_reg = guest_area->es.base;
238 PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
241 PrintDebug("cs Selector (at 0x%p): \n", &(guest_area->cs));
242 PrintDebug("\tSelector: %d\n", guest_area->cs.selector);
243 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
244 guest_area->cs.attrib.fields.type, guest_area->cs.attrib.fields.S,
245 guest_area->cs.attrib.fields.dpl, guest_area->cs.attrib.fields.P,
246 guest_area->cs.attrib.fields.avl, guest_area->cs.attrib.fields.L,
247 guest_area->cs.attrib.fields.db, guest_area->cs.attrib.fields.G);
248 PrintDebug("\tlimit: %u\n", guest_area->cs.limit);
249 tmp_reg.r_reg = guest_area->cs.base;
250 PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
253 PrintDebug("ss Selector (at 0x%p): \n", &(guest_area->ss));
254 PrintDebug("\tSelector: %d\n", guest_area->ss.selector);
255 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
256 guest_area->ss.attrib.fields.type, guest_area->ss.attrib.fields.S,
257 guest_area->ss.attrib.fields.dpl, guest_area->ss.attrib.fields.P,
258 guest_area->ss.attrib.fields.avl, guest_area->ss.attrib.fields.L,
259 guest_area->ss.attrib.fields.db, guest_area->ss.attrib.fields.G);
260 PrintDebug("\tlimit: %u\n", guest_area->ss.limit);
261 tmp_reg.r_reg = guest_area->ss.base;
262 PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
265 PrintDebug("ds Selector (at 0x%p): \n", &(guest_area->ds));
266 PrintDebug("\tSelector: %d\n", guest_area->ds.selector);
267 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
268 guest_area->ds.attrib.fields.type, guest_area->ds.attrib.fields.S,
269 guest_area->ds.attrib.fields.dpl, guest_area->ds.attrib.fields.P,
270 guest_area->ds.attrib.fields.avl, guest_area->ds.attrib.fields.L,
271 guest_area->ds.attrib.fields.db, guest_area->ds.attrib.fields.G);
272 PrintDebug("\tlimit: %u\n", guest_area->ds.limit);
273 tmp_reg.r_reg = guest_area->ds.base;
274 PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
277 PrintDebug("fs Selector (at 0x%p): \n", &(guest_area->fs));
278 PrintDebug("\tSelector: %d\n", guest_area->fs.selector);
279 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
280 guest_area->fs.attrib.fields.type, guest_area->fs.attrib.fields.S,
281 guest_area->fs.attrib.fields.dpl, guest_area->fs.attrib.fields.P,
282 guest_area->fs.attrib.fields.avl, guest_area->fs.attrib.fields.L,
283 guest_area->fs.attrib.fields.db, guest_area->fs.attrib.fields.G);
284 PrintDebug("\tlimit: %u\n", guest_area->fs.limit);
285 tmp_reg.r_reg = guest_area->fs.base;
286 PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
289 PrintDebug("gs Selector (at 0x%p): \n", &(guest_area->gs));
290 PrintDebug("\tSelector: %d\n", guest_area->gs.selector);
291 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
292 guest_area->gs.attrib.fields.type, guest_area->gs.attrib.fields.S,
293 guest_area->gs.attrib.fields.dpl, guest_area->gs.attrib.fields.P,
294 guest_area->gs.attrib.fields.avl, guest_area->gs.attrib.fields.L,
295 guest_area->gs.attrib.fields.db, guest_area->gs.attrib.fields.G);
296 PrintDebug("\tlimit: %u\n", guest_area->gs.limit);
297 tmp_reg.r_reg = guest_area->gs.base;
298 PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
301 PrintDebug("gdtr Selector (at 0x%p): \n", &(guest_area->gdtr));
302 PrintDebug("\tSelector: %d\n", guest_area->gdtr.selector);
303 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
304 guest_area->gdtr.attrib.fields.type, guest_area->gdtr.attrib.fields.S,
305 guest_area->gdtr.attrib.fields.dpl, guest_area->gdtr.attrib.fields.P,
306 guest_area->gdtr.attrib.fields.avl, guest_area->gdtr.attrib.fields.L,
307 guest_area->gdtr.attrib.fields.db, guest_area->gdtr.attrib.fields.G);
308 PrintDebug("\tlimit: %u\n", guest_area->gdtr.limit);
309 tmp_reg.r_reg = guest_area->gdtr.base;
310 PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
313 PrintDebug("ldtr Selector (at 0x%p): \n", &(guest_area->ldtr));
314 PrintDebug("\tSelector: %d\n", guest_area->ldtr.selector);
315 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
316 guest_area->ldtr.attrib.fields.type, guest_area->ldtr.attrib.fields.S,
317 guest_area->ldtr.attrib.fields.dpl, guest_area->ldtr.attrib.fields.P,
318 guest_area->ldtr.attrib.fields.avl, guest_area->ldtr.attrib.fields.L,
319 guest_area->ldtr.attrib.fields.db, guest_area->ldtr.attrib.fields.G);
320 PrintDebug("\tlimit: %u\n", guest_area->ldtr.limit);
321 tmp_reg.r_reg = guest_area->ldtr.base;
322 PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
325 PrintDebug("idtr Selector (at 0x%p): \n", &(guest_area->idtr));
326 PrintDebug("\tSelector: %d\n", guest_area->idtr.selector);
327 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
328 guest_area->idtr.attrib.fields.type, guest_area->idtr.attrib.fields.S,
329 guest_area->idtr.attrib.fields.dpl, guest_area->idtr.attrib.fields.P,
330 guest_area->idtr.attrib.fields.avl, guest_area->idtr.attrib.fields.L,
331 guest_area->idtr.attrib.fields.db, guest_area->idtr.attrib.fields.G);
332 PrintDebug("\tlimit: %u\n", guest_area->idtr.limit);
333 tmp_reg.r_reg = guest_area->idtr.base;
334 PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
337 PrintDebug("tr Selector (at 0x%p): \n", &(guest_area->tr));
338 PrintDebug("\tSelector: %d\n", guest_area->tr.selector);
339 PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n",
340 guest_area->tr.attrib.fields.type, guest_area->tr.attrib.fields.S,
341 guest_area->tr.attrib.fields.dpl, guest_area->tr.attrib.fields.P,
342 guest_area->tr.attrib.fields.avl, guest_area->tr.attrib.fields.L,
343 guest_area->tr.attrib.fields.db, guest_area->tr.attrib.fields.G);
344 PrintDebug("\tlimit: %u\n", guest_area->tr.limit);
345 tmp_reg.r_reg = guest_area->tr.base;
346 PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
349 PrintDebug("cpl: %d\n", guest_area->cpl);
352 tmp_reg.r_reg = guest_area->efer;
353 PrintDebug("EFER: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
355 tmp_reg.r_reg = guest_area->cr4;
356 PrintDebug("CR4: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
357 tmp_reg.r_reg = guest_area->cr3;
358 PrintDebug("CR3: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
359 tmp_reg.r_reg = guest_area->cr0;
360 PrintDebug("CR0: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
361 tmp_reg.r_reg = guest_area->dr7;
362 PrintDebug("DR7: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
363 tmp_reg.r_reg = guest_area->dr6;
364 PrintDebug("DR6: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
365 tmp_reg.r_reg = guest_area->rflags;
366 PrintDebug("RFLAGS: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
367 tmp_reg.r_reg = guest_area->rip;
368 PrintDebug("RIP: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
371 tmp_reg.r_reg = guest_area->rsp;
372 PrintDebug("RSP: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
375 tmp_reg.r_reg = guest_area->rax;
376 PrintDebug("RAX: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
377 tmp_reg.r_reg = guest_area->star;
378 PrintDebug("STAR: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
379 tmp_reg.r_reg = guest_area->lstar;
380 PrintDebug("LSTAR: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
381 tmp_reg.r_reg = guest_area->cstar;
382 PrintDebug("CSTAR: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
383 tmp_reg.r_reg = guest_area->sfmask;
384 PrintDebug("SFMASK: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
385 tmp_reg.r_reg = guest_area->KernelGsBase;
386 PrintDebug("KernelGsBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
387 tmp_reg.r_reg = guest_area->sysenter_cs;
388 PrintDebug("sysenter_cs: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
389 tmp_reg.r_reg = guest_area->sysenter_esp;
390 PrintDebug("sysenter_esp: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
391 tmp_reg.r_reg = guest_area->sysenter_eip;
392 PrintDebug("sysenter_eip: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
393 tmp_reg.r_reg = guest_area->cr2;
394 PrintDebug("CR2: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
396 tmp_reg.r_reg = guest_area->g_pat;
397 PrintDebug("g_pat: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
398 tmp_reg.r_reg = guest_area->dbgctl;
399 PrintDebug("dbgctl: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
400 tmp_reg.r_reg = guest_area->br_from;
401 PrintDebug("br_from: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
402 tmp_reg.r_reg = guest_area->br_to;
403 PrintDebug("br_to: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
404 tmp_reg.r_reg = guest_area->lastexcpfrom;
405 PrintDebug("lastexcpfrom: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);
406 tmp_reg.r_reg = guest_area->lastexcpto;
407 PrintDebug("lastexcpto: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low);