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.


removed old extension files
[palacios-OLD.git] / palacios / src / palacios / vmcb.c
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 #include <palacios/vmcb.h>
21 #include <palacios/vmm.h>
22 #include <palacios/vmm_util.h>
23
24
25
26 void v3_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;
38 }
39
40
41 void v3_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;
53 }
54
55
56 void v3_set_vmcb_segments(vmcb_t * vmcb, struct v3_segments * segs) {
57     vmcb_saved_state_t * guest_area = GET_VMCB_SAVE_STATE_AREA(vmcb);
58
59     v3_set_vmcb_segment(&(guest_area->cs), &(segs->cs));
60     v3_set_vmcb_segment(&(guest_area->ds), &(segs->ds));
61     v3_set_vmcb_segment(&(guest_area->es), &(segs->es));
62     v3_set_vmcb_segment(&(guest_area->fs), &(segs->fs));
63     v3_set_vmcb_segment(&(guest_area->gs), &(segs->gs));
64     v3_set_vmcb_segment(&(guest_area->ss), &(segs->ss));
65     v3_set_vmcb_segment(&(guest_area->ldtr), &(segs->ldtr));
66     v3_set_vmcb_segment(&(guest_area->gdtr), &(segs->gdtr));
67     v3_set_vmcb_segment(&(guest_area->idtr), &(segs->idtr));
68     v3_set_vmcb_segment(&(guest_area->tr), &(segs->tr));
69 }
70
71
72 void v3_get_vmcb_segments(vmcb_t * vmcb, struct v3_segments * segs) {
73     vmcb_saved_state_t * guest_area = GET_VMCB_SAVE_STATE_AREA(vmcb);
74
75     v3_get_vmcb_segment(&(guest_area->cs), &(segs->cs));
76     v3_get_vmcb_segment(&(guest_area->ds), &(segs->ds));
77     v3_get_vmcb_segment(&(guest_area->es), &(segs->es));
78     v3_get_vmcb_segment(&(guest_area->fs), &(segs->fs));
79     v3_get_vmcb_segment(&(guest_area->gs), &(segs->gs));
80     v3_get_vmcb_segment(&(guest_area->ss), &(segs->ss));
81     v3_get_vmcb_segment(&(guest_area->ldtr), &(segs->ldtr));
82     v3_get_vmcb_segment(&(guest_area->gdtr), &(segs->gdtr));
83     v3_get_vmcb_segment(&(guest_area->idtr), &(segs->idtr));
84     v3_get_vmcb_segment(&(guest_area->tr), &(segs->tr));
85 }
86
87
88 void PrintDebugVMCB(vmcb_t * vmcb) {
89     reg_ex_t tmp_reg;
90
91     vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA(vmcb);
92     vmcb_saved_state_t * guest_area = GET_VMCB_SAVE_STATE_AREA(vmcb);
93
94     PrintDebug("VMCB (0x%p)\n", (void *)vmcb);
95
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));
101   
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);
122
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);
156
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);
171
172
173
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);
180
181     PrintDebug("guest_ASID: %d\n", ctrl_area->guest_ASID);
182     PrintDebug("TLB_CONTROL: %d\n", ctrl_area->TLB_CONTROL);
183
184
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);
192
193     PrintDebug("Interrupt_shadow: %d\n", ctrl_area->interrupt_shadow);
194
195
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);
202
203
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);
209
210
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);
213
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);
219
220
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);
223
224     PrintDebug("LBR_VIRTUALIZATION_ENABLE: %d\n", ctrl_area->LBR_VIRTUALIZATION_ENABLE);
225
226
227     PrintDebug("\n--Guest Saved State--\n");
228
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);
239
240
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);
251
252
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);
263
264
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);
275
276
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);
287
288
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);
299
300
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);
311
312
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);
323
324
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);
335
336
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);
347
348
349     PrintDebug("cpl: %d\n", guest_area->cpl);
350
351   
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);
354
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);
369
370
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);
373
374   
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);
395
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);
408 }