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
33 struct segment_selector {
37 }__attribute__((packed));
39 struct int_trap_gate_long {
40 uint16_t offset_lo : 16;
41 uint16_t selector : 16;
48 uint16_t offset_mid : 16;
49 uint32_t offset_hi : 32;
51 }__attribute__((packed));
53 struct call_gate_long {
54 uint16_t offset_lo : 16;
55 uint16_t selector : 16;
61 uint16_t offset_mid : 16;
62 uint32_t offset_hi : 32;
66 }__attribute__((packed));
68 struct system_desc_long {
69 uint16_t limit_lo : 16;
70 uint16_t base_lo : 16;
71 uint8_t base_mid1 : 8;
80 uint8_t base_mid2 : 8;
81 uint32_t base_hi : 32;
83 uint8_t lgcy_type : 5;
85 }__attribute__((packed));
87 struct data_desc_long {
88 uint16_t limit_lo : 16;
89 uint16_t base_lo : 16;
104 }__attribute__((packed));
106 struct code_desc_long {
107 uint16_t limit_lo : 16;
108 uint16_t base_lo : 16;
109 uint8_t base_mid : 8;
117 uint8_t limit_hi : 4;
123 }__attribute__((packed));
125 struct int_trap_gate_lgcy {
126 uint16_t offset_lo : 16;
127 uint16_t selector : 16;
133 uint16_t offset_hi : 16;
134 }__attribute__((packed));
136 struct call_gate_lgcy {
137 uint16_t offset_lo : 16;
138 uint16_t selector : 16;
145 uint16_t offset_hi : 16;
146 }__attribute__((packed));
148 struct trap_gate_lgcy {
150 uint16_t selector : 16;
157 }__attribute__((packed));
159 struct system_desc_lgcy {
160 uint16_t limit_lo : 16;
161 uint16_t base_lo : 16;
162 uint8_t base_mid : 8;
167 uint8_t limit_hi : 4;
172 }__attribute__((packed));
174 struct data_desc_lgcy {
175 uint16_t limit_lo : 16;
176 uint16_t base_lo : 16;
177 uint8_t base_mid : 8;
182 uint8_t limit_hi : 4;
188 }__attribute__((packed));
190 struct code_desc_lgcy {
191 uint16_t limit_lo : 16;
192 uint16_t base_lo : 16;
193 uint8_t base_mid : 8;
198 uint8_t limit_hi : 4;
204 }__attribute__((packed));
207 struct selector_error_code {
213 }__attribute__((packed));
216 int v3_init_vm_debugging(struct v3_vm_info * vm);
218 void v3_print_guest_state(struct guest_info * core);
219 void v3_print_arch_state(struct guest_info * core);
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);
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);
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);