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".
21 #ifndef __VMM_DEBUG_H__
22 #define __VMM_DEBUG_H__
27 #include <palacios/vmm.h>
28 #include <palacios/vmm_regs.h>
30 #define NUM_IDT_ENTRIES 256
31 #define NUM_GDT_ENTRIES 16
32 #define NUM_LDT_ENTRIES 16
34 struct segment_selector {
38 }__attribute__((packed));
40 struct int_trap_gate_long {
41 uint16_t offset_lo : 16;
42 uint16_t selector : 16;
49 uint16_t offset_mid : 16;
50 uint32_t offset_hi : 32;
52 }__attribute__((packed));
54 struct call_gate_long {
55 uint16_t offset_lo : 16;
56 uint16_t selector : 16;
62 uint16_t offset_mid : 16;
63 uint32_t offset_hi : 32;
67 }__attribute__((packed));
69 struct system_desc_long {
70 uint16_t limit_lo : 16;
71 uint16_t base_lo : 16;
72 uint8_t base_mid1 : 8;
81 uint8_t base_mid2 : 8;
82 uint32_t base_hi : 32;
84 uint8_t lgcy_type : 5;
86 }__attribute__((packed));
88 struct data_desc_long {
89 uint16_t limit_lo : 16;
90 uint16_t base_lo : 16;
105 }__attribute__((packed));
107 struct code_desc_long {
108 uint16_t limit_lo : 16;
109 uint16_t base_lo : 16;
110 uint8_t base_mid : 8;
118 uint8_t limit_hi : 4;
124 }__attribute__((packed));
126 struct int_trap_gate_lgcy {
127 uint16_t offset_lo : 16;
128 uint16_t selector : 16;
134 uint16_t offset_hi : 16;
135 }__attribute__((packed));
137 struct call_gate_lgcy {
138 uint16_t offset_lo : 16;
139 uint16_t selector : 16;
146 uint16_t offset_hi : 16;
147 }__attribute__((packed));
149 struct trap_gate_lgcy {
151 uint16_t selector : 16;
158 }__attribute__((packed));
160 struct system_desc_lgcy {
161 uint16_t limit_lo : 16;
162 uint16_t base_lo : 16;
163 uint8_t base_mid : 8;
168 uint8_t limit_hi : 4;
173 }__attribute__((packed));
175 struct data_desc_lgcy {
176 uint16_t limit_lo : 16;
177 uint16_t base_lo : 16;
178 uint8_t base_mid : 8;
183 uint8_t limit_hi : 4;
189 }__attribute__((packed));
191 struct code_desc_lgcy {
192 uint16_t limit_lo : 16;
193 uint16_t base_lo : 16;
194 uint8_t base_mid : 8;
199 uint8_t limit_hi : 4;
205 }__attribute__((packed));
208 struct selector_error_code {
214 }__attribute__((packed));
232 // Followed by up to 8 KB of io permission bitmap
233 } __attribute__((packed));
236 int v3_init_vm_debugging(struct v3_vm_info * vm);
238 void v3_print_guest_state(struct guest_info * core);
239 void v3_print_arch_state(struct guest_info * core);
241 void v3_print_segments(struct v3_segments * segs);
242 void v3_print_ctrl_regs(struct guest_info * core);
243 void v3_print_GPRs(struct guest_info * core);
245 void v3_print_backtrace(struct guest_info * core);
246 void v3_print_stack(struct guest_info * core);
247 void v3_print_guest_state_all(struct v3_vm_info * vm);
249 void v3_print_idt(struct guest_info * core, addr_t idtr_base);
250 void v3_print_gdt(struct guest_info * core, addr_t gdtr_base);
251 void v3_print_ldt(struct guest_info * core, addr_t ldtr_base);
252 void v3_print_tss(struct guest_info * core, addr_t ldtr_base);
253 void v3_print_gp_error(struct guest_info * core, addr_t exit_info1);