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 #include <palacios/vmm_debug.h>
22 #include <palacios/vmm.h>
23 #include <palacios/vmm_host_events.h>
24 #include <palacios/vm_guest.h>
25 #include <palacios/vmm_decoder.h>
26 #include <palacios/vm_guest_mem.h>
27 #include <palacios/vmm_config.h>
29 #define PRINT_TELEMETRY 1
30 #define PRINT_CORE_STATE 2
31 #define PRINT_ARCH_STATE 3
33 #define PRINT_BACKTRACE 5
36 #define PRINT_ALL 100 // Absolutely everything
37 #define PRINT_STATE 101 // telemetry, core state, arch state
42 static int core_handler(struct guest_info * core, uint32_t cmd) {
46 #ifdef V3_CONFIG_TELEMETRY
48 v3_print_core_telemetry(core);
52 case PRINT_CORE_STATE:
53 v3_raise_barrier(core->vm_info, NULL);
55 v3_print_guest_state(core);
57 v3_lower_barrier(core->vm_info);
59 case PRINT_ARCH_STATE:
60 v3_raise_barrier(core->vm_info, NULL);
62 v3_print_arch_state(core);
64 v3_lower_barrier(core->vm_info);
67 v3_raise_barrier(core->vm_info, NULL);
71 v3_lower_barrier(core->vm_info);
74 v3_raise_barrier(core->vm_info, NULL);
76 v3_print_backtrace(core);
78 v3_lower_barrier(core->vm_info);
82 v3_raise_barrier(core->vm_info, NULL);
84 #ifdef V3_CONFIG_TELEMETRY
85 v3_print_core_telemetry(core);
87 v3_print_guest_state(core);
88 v3_print_arch_state(core);
90 v3_lower_barrier(core->vm_info);
94 v3_raise_barrier(core->vm_info, NULL);
96 #ifdef V3_CONFIG_TELEMETRY
97 v3_print_core_telemetry(core);
99 v3_print_guest_state(core);
100 v3_print_arch_state(core);
101 v3_print_stack(core);
102 v3_print_backtrace(core);
104 v3_lower_barrier(core->vm_info);
113 static int evt_handler(struct v3_vm_info * vm, struct v3_debug_event * evt, void * priv_data) {
115 V3_Print(vm, VCORE_NONE,"Debug Event Handler for core %d cmd=%x\n", evt->core_id, evt->cmd);
117 if (evt->core_id == -1) {
119 for (i = 0; i < vm->num_cores; i++) {
120 core_handler(&(vm->cores[i]), evt->cmd);
123 return core_handler(&vm->cores[evt->core_id], evt->cmd);
131 int v3_init_vm_debugging(struct v3_vm_info * vm) {
132 v3_hook_host_event(vm, HOST_DEBUG_EVT,
133 V3_HOST_EVENT_HANDLER(evt_handler),
144 void v3_print_segments(struct v3_segments * segs) {
146 struct v3_segment * seg_ptr;
148 seg_ptr=(struct v3_segment *)segs;
150 char *seg_names[] = {"CS", "DS" , "ES", "FS", "GS", "SS" , "LDTR", "GDTR", "IDTR", "TR", NULL};
151 V3_Print(VM_NONE, VCORE_NONE, "Segments\n");
153 for (i = 0; seg_names[i] != NULL; i++) {
155 V3_Print(VM_NONE, VCORE_NONE, "\t%s: selector=0x%x, base=%p, limit=0x%x type=0x%x system=0x%x dpl=0x%x present=0x%x avail=0x%x long_mode=0x%x db=0x%x granularity=0x%x unusable=0x%x\n",
158 (void *)(addr_t)seg_ptr[i].base,
165 seg_ptr[i].long_mode,
167 seg_ptr[i].granularity,
168 seg_ptr[i].unusable);
174 void v3_print_ctrl_regs(struct guest_info * core) {
175 struct v3_ctrl_regs * regs = &(core->ctrl_regs);
178 char * reg_names[] = {"CR0", "CR2", "CR3", "CR4", "CR8", "FLAGS", "EFER", NULL};
181 reg_ptr = (v3_reg_t *)regs;
183 V3_Print(core->vm_info, core,"Ctrl Regs:\n");
185 for (i = 0; reg_names[i] != NULL; i++) {
186 V3_Print(core->vm_info, core, "\t%s=0x%p (at %p)\n", reg_names[i], (void *)(addr_t)reg_ptr[i], &(reg_ptr[i]));
193 static int safe_gva_to_hva(struct guest_info * core, addr_t linear_addr, addr_t * host_addr) {
194 /* select the proper translation based on guest mode */
195 if (core->mem_mode == PHYSICAL_MEM) {
196 if (v3_gpa_to_hva(core, linear_addr, host_addr) == -1) return -1;
197 } else if (core->mem_mode == VIRTUAL_MEM) {
198 if (v3_gva_to_hva(core, linear_addr, host_addr) == -1) return -1;
203 static int v3_print_disassembly(struct guest_info * core) {
205 addr_t rip, rip_linear, rip_host;
207 /* we don't know where the instructions preceding RIP start, so we just take
208 * a guess and hope the instruction stream synced up with our disassembly
209 * some time before RIP; if it has not we correct RIP at that point
212 /* start disassembly 64 bytes before current RIP, continue 32 bytes after */
213 rip = (addr_t) core->rip - 64;
214 while ((int) (rip - core->rip) < 32) {
215 V3_Print(info->vm_info, info, "disassembly step\n");
217 /* always print RIP, even if the instructions before were bad */
218 if (!passed_rip && rip >= core->rip) {
219 if (rip != core->rip) {
220 V3_Print(info->vm_info, info, "***** bad disassembly up to this point *****\n");
226 /* look up host virtual address for this instruction */
227 rip_linear = get_addr_linear(core, rip, &(core->segments.cs));
228 if (safe_gva_to_hva(core, rip_linear, &rip_host) < 0) {
233 /* print disassembled instrcution (updates rip) */
234 if (v3_disasm(core, (void *) rip_host, &rip, rip == core->rip) < 0) {
246 void v3_print_guest_state(struct guest_info * core) {
247 addr_t linear_addr = 0;
249 V3_Print(core->vm_info, core, "RIP: %p\n", (void *)(addr_t)(core->rip));
250 linear_addr = get_addr_linear(core, core->rip, &(core->segments.cs));
251 V3_Print(core->vm_info, core, "RIP Linear: %p\n", (void *)linear_addr);
253 V3_Print(core->vm_info, core, "NumExits: %u\n", (uint32_t)core->num_exits);
255 V3_Print(core->vm_info, core, "IRQ STATE: started=%d, pending=%d\n",
256 core->intr_core_state.irq_started,
257 core->intr_core_state.irq_pending);
258 V3_Print(core->vm_info, core, "EXCP STATE: err_code_valid=%d, err_code=%x\n",
259 core->excp_state.excp_error_code_valid,
260 core->excp_state.excp_error_code);
263 v3_print_segments(&(core->segments));
264 v3_print_ctrl_regs(core);
266 if (core->shdw_pg_mode == SHADOW_PAGING) {
267 V3_Print(core->vm_info, core, "Shadow Paging Guest Registers:\n");
268 V3_Print(core->vm_info, core, "\tGuest CR0=%p\n", (void *)(addr_t)(core->shdw_pg_state.guest_cr0));
269 V3_Print(core->vm_info, core, "\tGuest CR3=%p\n", (void *)(addr_t)(core->shdw_pg_state.guest_cr3));
270 V3_Print(core->vm_info, core, "\tGuest EFER=%p\n", (void *)(addr_t)(core->shdw_pg_state.guest_efer.value));
275 v3_print_idt(core,core->segments.idtr.base);
276 v3_print_gdt(core,core->segments.gdtr.base);
277 v3_print_ldt(core,core->segments.ldtr.base);
278 v3_print_tss(core,core->segments.tr.base);
280 v3_print_mem_map(core->vm_info);
282 v3_print_stack(core);
284 // v3_print_disassembly(core);
288 void v3_print_arch_state(struct guest_info * core) {
294 void v3_print_guest_state_all(struct v3_vm_info * vm) {
297 V3_Print(vm, VCORE_NONE,"VM Core states for %s\n", vm->name);
299 for (i = 0; i < 80; i++) {
300 V3_Print(vm, VCORE_NONE, "-");
303 for (i = 0; i < vm->num_cores; i++) {
304 v3_print_guest_state(&vm->cores[i]);
307 for (i = 0; i < 80; i++) {
308 V3_Print(vm, VCORE_NONE, "-");
311 V3_Print(vm, VCORE_NONE, "\n");
316 void v3_print_stack(struct guest_info * core) {
317 addr_t linear_addr = 0;
318 addr_t host_addr = 0;
320 v3_cpu_mode_t cpu_mode = v3_get_vm_cpu_mode(core);
322 linear_addr = get_addr_linear(core, core->vm_regs.rsp, &(core->segments.ss));
324 V3_Print(core->vm_info, core, "Stack at %p:\n", (void *)linear_addr);
326 if (core->mem_mode == PHYSICAL_MEM) {
327 if (v3_gpa_to_hva(core, linear_addr, &host_addr) == -1) {
328 PrintError(core->vm_info, core, "Could not translate Stack address\n");
331 } else if (core->mem_mode == VIRTUAL_MEM) {
332 if (v3_gva_to_hva(core, linear_addr, &host_addr) == -1) {
333 PrintError(core->vm_info, core, "Could not translate Virtual Stack address\n");
338 V3_Print(core->vm_info, core, "Host Address of rsp = 0x%p\n", (void *)host_addr);
340 // We start i at one because the current stack pointer points to an unused stack element
341 for (i = 0; i <= 24; i++) {
343 if (cpu_mode == REAL) {
344 V3_Print(core->vm_info, core, "\t0x%.4x\n", *((uint16_t *)host_addr + (i * 2)));
345 } else if (cpu_mode == LONG) {
346 V3_Print(core->vm_info, core, "\t%p\n", (void *)*(addr_t *)(host_addr + (i * 8)));
349 V3_Print(core->vm_info, core, "\t0x%.8x\n", *(uint32_t *)(host_addr + (i * 4)));
356 void v3_print_backtrace(struct guest_info * core) {
359 v3_cpu_mode_t cpu_mode = v3_get_vm_cpu_mode(core);
360 struct v3_cfg_file * system_map = v3_cfg_get_file(core->vm_info, "System.map");
362 V3_Print(core->vm_info, core, "Performing Backtrace for Core %d\n", core->vcpu_id);
363 V3_Print(core->vm_info, core, "\tRSP=%p, RBP=%p\n", (void *)core->vm_regs.rsp, (void *)core->vm_regs.rbp);
365 gla_rbp = get_addr_linear(core, core->vm_regs.rbp, &(core->segments.ss));
368 for (i = 0; i < 30; i++) {
371 char * sym_name = NULL;
374 if (core->mem_mode == PHYSICAL_MEM) {
375 if (v3_gpa_to_hva(core, gla_rbp, &hva_rbp) == -1) {
376 PrintError(core->vm_info, core, "Could not translate Stack address\n");
379 } else if (core->mem_mode == VIRTUAL_MEM) {
380 if (v3_gva_to_hva(core, gla_rbp, &hva_rbp) == -1) {
381 PrintError(core->vm_info, core, "Could not translate Virtual Stack address\n");
387 hva_rip = hva_rbp + v3_get_addr_width(core);
389 if (cpu_mode == REAL) {
390 rip_val = (addr_t)*(uint16_t *)hva_rip;
391 } else if (cpu_mode == LONG) {
392 rip_val = (addr_t)*(uint64_t *)hva_rip;
394 rip_val = (addr_t)*(uint32_t *)hva_rip;
398 char * tmp_ptr = system_map->data;
399 char * sym_ptr = NULL;
400 uint64_t file_offset = 0;
401 uint64_t sym_offset = 0;
403 while (file_offset < system_map->size) {
404 sym_offset = strtox(tmp_ptr, &tmp_ptr);
406 tmp_ptr += 3; // pass over symbol type
408 if (sym_offset > rip_val) {
409 char * end_ptr = strchr(sym_ptr, '\n');
412 *end_ptr = 0; // null terminate symbol...
421 char * end_ptr2 = strchr(tmp_ptr, '\n');
424 tmp_ptr += strlen(tmp_ptr) + 1;
426 tmp_ptr = end_ptr2 + 1;
436 if (cpu_mode == REAL) {
437 V3_Print(core->vm_info, core, "Next RBP=0x%.4x, RIP=0x%.4x (%s)\n",
438 *(uint16_t *)hva_rbp,*(uint16_t *)hva_rip,
441 gla_rbp = *(uint16_t *)hva_rbp;
442 } else if (cpu_mode == LONG) {
443 V3_Print(core->vm_info, core, "Next RBP=%p, RIP=%p (%s)\n",
444 (void *)*(uint64_t *)hva_rbp, (void *)*(uint64_t *)hva_rip,
446 gla_rbp = *(uint64_t *)hva_rbp;
448 V3_Print(core->vm_info, core, "Next RBP=0x%.8x, RIP=0x%.8x (%s)\n",
449 *(uint32_t *)hva_rbp, *(uint32_t *)hva_rip,
451 gla_rbp = *(uint32_t *)hva_rbp;
460 void v3_print_GPRs(struct guest_info * core) {
461 struct v3_gprs * regs = &(core->vm_regs);
464 char * reg_names[] = { "RDI", "RSI", "RBP", "RSP", "RBX", "RDX", "RCX", "RAX", NULL};
466 reg_ptr = (v3_reg_t *)regs;
468 V3_Print(info->vm_info, info, "32 bit GPRs:\n");
470 for (i = 0; reg_names[i] != NULL; i++) {
471 V3_Print(info->vm_info, info, "\t%s=0x%p (at %p)\n", reg_names[i], (void *)(addr_t)reg_ptr[i], &(reg_ptr[i]));
475 void v3_print_idt(struct guest_info * core, addr_t idtr_base) {
478 if (v3_get_vm_cpu_mode(core)!=LONG) {
479 V3_Print(core->vm_info, core, "= IDT ========\n");
480 V3_Print(core->vm_info, core, "(currently only supported in long mode)\n");
485 if (core->mem_mode == PHYSICAL_MEM) {
487 get_addr_linear(core, idtr_base, &(core->segments.cs)),
489 PrintError(core->vm_info, core, "Kind of weird that we got here.... physical mem?\n");
490 } else if (core->mem_mode == VIRTUAL_MEM) {
492 get_addr_linear(core, idtr_base, &(core->segments.cs)),
497 if (idtr_base != get_addr_linear(core, idtr_base, &(core->segments.cs))) {
498 PrintError(core->vm_info, core, "idtr base address != linear translation, might be something funky with cs\n");
502 PrintError(core->vm_info, core "idtr address does not translate! skipping.\n");
507 char *types[16] = {" ILGL","aTSS16"," LDT","bTSS16","call16"," task","intr16","trap16",
508 " ILGL","aTSS32"," ILGL","bTSS32","call32"," ILGL","intr32","trap32"};
510 struct int_trap_gate_lgcy * entry;
511 entry = (struct int_trap_gate_lgcy *)base_hva;
512 V3_Print(core->vm_info, core, "= IDT ========\n");
513 V3_Print(core->vm_info, core, " # | hex | selector | si:ti:rpl | offset | type | dpl | s | p\n");
514 for (i = 0; i < NUM_IDT_ENTRIES; i++) {
515 uint32_t tmp = entry->selector;
516 struct segment_selector * seg = (struct segment_selector *)(&tmp);
517 V3_Print(core->vm_info, core, "%3d | %3x | %04x | %03x:%x:%x | %04x%04x | %s | %x | %x | %x | %x\n", i, i,
519 seg->index, seg->ti, seg->rpl,
520 entry->offset_hi, entry->offset_lo,
521 types[entry->type], entry->dpl, entry->s, entry->p);
526 void v3_print_gdt(struct guest_info * core, addr_t gdtr_base) {
529 if (v3_get_vm_cpu_mode(core)!=LONG) {
530 V3_Print(core->vm_info, core, "= GDT ========\n");
531 V3_Print(core->vm_info, core, "(currently only supported in long mode)\n");
535 if (core->mem_mode == PHYSICAL_MEM) {
537 get_addr_linear(core, gdtr_base, &(core->segments.cs)),
539 PrintError(core->vm_info, core, "Kind of weird that we got here.... physical mem?\n");
540 } else if (core->mem_mode == VIRTUAL_MEM) {
542 get_addr_linear(core, gdtr_base, &(core->segments.cs)),
547 if (gdtr_base != get_addr_linear(core, gdtr_base, &(core->segments.cs))) {
548 PrintError(core->vm_info, core, "gdtr base address != linear translation, might be something funky with cs\n");
552 PrintError(core->vm_info, core "gdtr address does not translate! skipping.\n");
557 char* cd[2] = {"data","code"};
558 // TODO: handle possibility of gate/segment descriptor
560 struct code_desc_lgcy * entry;
561 entry = (struct code_desc_long *)base_hva;
562 V3_Print(core->vm_info, core, "= GDT ========\n");
563 V3_Print(core->vm_info, core, " # | hex | limit | base | c/d | dpl | p\n");
564 for (i = 0; i < NUM_GDT_ENTRIES; i++) {
565 V3_Print(core->vm_info, core, "%3d | %3x | %x%04x | %02x%02x%04x | %s | %x | %x\n", i, i,
566 entry->limit_hi, entry->limit_lo,
567 entry->base_hi, entry->base_mid, entry->base_lo,
568 cd[entry->one1], entry->dpl, entry->p);
573 void v3_print_gp_error(struct guest_info * core, addr_t exit_info1) {
574 struct selector_error_code * error = (struct selector_error_code *)(&exit_info1);
576 V3_Print(core->vm_info, core, " selector index: %x, TI: %x, IDT: %x, EXT: %x (error=%llx)\n",
577 error->index, error->ti, error->idt, error->ext,
578 (unsigned long long)exit_info1);
583 void v3_print_GPRs(struct guest_info * core) {
584 struct v3_gprs * regs = &(core->vm_regs);
587 char * reg_names[] = { "RDI", "RSI", "RBP", "RSP", "RBX", "RDX", "RCX", "RAX", \
588 "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15", NULL};
590 reg_ptr = (v3_reg_t *)regs;
592 V3_Print(core->vm_info, core, "64 bit GPRs:\n");
594 for (i = 0; reg_names[i] != NULL; i++) {
595 V3_Print(core->vm_info, core, "\t%s=0x%p (at %p)\n", reg_names[i], (void *)(addr_t)reg_ptr[i], &(reg_ptr[i]));
599 void v3_print_idt(struct guest_info * core, addr_t idtr_base) {
602 if (v3_get_vm_cpu_mode(core)!=LONG) {
603 V3_Print(core->vm_info, core, "= IDT ========\n");
604 V3_Print(core->vm_info, core, "(currently only supported in long mode)\n");
608 if (core->mem_mode == PHYSICAL_MEM) {
610 get_addr_linear(core, idtr_base, &(core->segments.cs)),
612 } else if (core->mem_mode == VIRTUAL_MEM) {
614 get_addr_linear(core, idtr_base, &(core->segments.cs)),
619 if (idtr_base != get_addr_linear(core, idtr_base, &(core->segments.cs))) {
620 PrintError(core->vm_info, core, "idtr base address != linear translation, might be something funky with cs\n");
624 PrintError(core->vm_info, core, "idtr address does not translate! skipping.\n");
629 char *types[16] = {"ILGL","ILGL"," LDT","ILGL","ILGL","ILGL","ILGL","ILGL","ILGL",
630 "aTSS","ILGL","bTSS","call","ILGL","intr","trap"};
632 struct int_trap_gate_long * entry;
633 entry = (struct int_trap_gate_long *)base_hva;
634 V3_Print(core->vm_info, core, "= IDT ========\n");
635 V3_Print(core->vm_info, core, " # | hex | selector | si:ti:rpl | offset | type | dpl | s | r | p\n");
636 for (i = 0; i < NUM_IDT_ENTRIES; i++) {
637 uint32_t tmp = entry->selector;
638 struct segment_selector * seg = (struct segment_selector *)(&tmp);
639 V3_Print(core->vm_info, core, "%3d | %3x | %04x | %03x:%x:%x | %08x%04x%04x | %s | %x | %x | %x | %x\n", i, i,
641 seg->index, seg->ti, seg->rpl,
642 entry->offset_hi, entry->offset_mid, entry->offset_lo,
643 types[entry->type], entry->dpl, entry->s,
649 void v3_print_gdt(struct guest_info * core, addr_t gdtr_base) {
652 if (v3_get_vm_cpu_mode(core)!=LONG) {
653 V3_Print(core->vm_info, core, "= GDT ========\n");
654 V3_Print(core->vm_info, core, "(currently only supported in long mode)\n");
658 if (core->mem_mode == PHYSICAL_MEM) {
660 get_addr_linear(core, gdtr_base, &(core->segments.cs)),
662 } else if (core->mem_mode == VIRTUAL_MEM) {
664 get_addr_linear(core, gdtr_base, &(core->segments.cs)),
669 if (gdtr_base != get_addr_linear(core, gdtr_base, &(core->segments.cs))) {
670 PrintError(core->vm_info, core, "gdtr base address != linear translation, might be something funky with cs\n");
674 PrintError(core->vm_info, core, "gdtr address does not translate! skipping.\n");
679 char* cd[2] = {"data","code"};
680 // TODO: handle possibility of gate/segment descriptor
682 struct code_desc_long * entry;
683 entry = (struct code_desc_long *)base_hva;
684 V3_Print(core->vm_info, core, "= GDT ========\n");
685 V3_Print(core->vm_info, core, " # | hex | limit | base | c/d | dpl | p\n");
686 for (i = 0; i < NUM_GDT_ENTRIES; i++) {
687 V3_Print(core->vm_info, core, "%3d | %3x | %x%04x | %02x%02x%04x | %s | %x | %x\n", i, i,
688 entry->limit_hi, entry->limit_lo,
689 entry->base_hi, entry->base_mid, entry->base_lo,
690 cd[entry->one1], entry->dpl, entry->p);
695 void v3_print_ldt(struct guest_info * core, addr_t ldtr_base) {
698 if (v3_get_vm_cpu_mode(core)!=LONG) {
699 V3_Print(core->vm_info, core, "= LDT ========\n");
700 V3_Print(core->vm_info, core, "(currently only supported in long mode)\n");
704 V3_Print(core->vm_info, core, "= LDT ========\n");
706 if (ldtr_base == 0) {
707 V3_Print(core->vm_info, core, " (no LDT is installed)\n");
711 if (core->mem_mode == PHYSICAL_MEM) {
713 get_addr_linear(core, ldtr_base, &(core->segments.cs)),
715 } else if (core->mem_mode == VIRTUAL_MEM) {
717 get_addr_linear(core, ldtr_base, &(core->segments.cs)),
722 if (ldtr_base != get_addr_linear(core, ldtr_base, &(core->segments.cs))) {
723 PrintError(core->vm_info, core, "ldtr base address != linear translation, might be something funky with cs\n");
727 PrintError(core->vm_info, core, "ldtr address does not translate! skipping.\n");
732 char* cd[2] = {"data","code"};
733 // TODO: handle possibility of gate/segment descriptor
735 struct code_desc_long * entry;
736 entry = (struct code_desc_long *)base_hva;
737 V3_Print(core->vm_info, core, " # | hex | limit | base | c/d | dpl | p\n");
738 for (i = 0; i < NUM_LDT_ENTRIES; i++) {
739 V3_Print(core->vm_info, core, "%3d | %3x | %x%04x | %02x%02x%04x | %s | %x | %x\n", i, i,
740 entry->limit_hi, entry->limit_lo,
741 entry->base_hi, entry->base_mid, entry->base_lo,
742 cd[entry->one1], entry->dpl, entry->p);
747 void v3_print_tss(struct guest_info * core, addr_t tr_base) {
751 if (v3_get_vm_cpu_mode(core)!=LONG) {
752 V3_Print(core->vm_info, core, "= TSS ========\n");
753 V3_Print(core->vm_info, core, "(currently only supported in long mode)\n");
757 V3_Print(core->vm_info, core, "= TSS ========\n");
760 V3_Print(core->vm_info, core, " (no TSS is installed)\n");
764 if (core->mem_mode == PHYSICAL_MEM) {
766 get_addr_linear(core, tr_base, &(core->segments.cs)),
768 } else if (core->mem_mode == VIRTUAL_MEM) {
770 get_addr_linear(core, tr_base, &(core->segments.cs)),
775 if (tr_base != get_addr_linear(core, tr_base, &(core->segments.cs))) {
776 PrintError(core->vm_info, core, "tr base address != linear translation, might be something funky with cs\n");
780 PrintError(core->vm_info, core, "tr address does not translate! skipping.\n");
784 t=(struct tss_long*)base_hva;
786 V3_Print(core->vm_info, core," res1 : 0x%llx\n", (uint64_t) t->res1);
787 V3_Print(core->vm_info, core," rsp0 : 0x%llx\n", t->rsp0);
788 V3_Print(core->vm_info, core," rsp1 : 0x%llx\n", t->rsp1);
789 V3_Print(core->vm_info, core," rsp2 : 0x%llx\n", t->rsp2);
790 V3_Print(core->vm_info, core," res2 : 0x%llx\n", t->res2);
791 V3_Print(core->vm_info, core," ist1 : 0x%llx\n", t->ist1);
792 V3_Print(core->vm_info, core," ist2 : 0x%llx\n", t->ist2);
793 V3_Print(core->vm_info, core," ist3 : 0x%llx\n", t->ist3);
794 V3_Print(core->vm_info, core," ist4 : 0x%llx\n", t->ist4);
795 V3_Print(core->vm_info, core," ist5 : 0x%llx\n", t->ist5);
796 V3_Print(core->vm_info, core," ist6 : 0x%llx\n", t->ist6);
797 V3_Print(core->vm_info, core," ist7 : 0x%llx\n", t->ist7);
798 V3_Print(core->vm_info, core," res3 : 0x%llx\n", t->res3);
799 V3_Print(core->vm_info, core," res4 : 0x%llx\n", (uint64_t) t->res4);
800 V3_Print(core->vm_info, core," iomap_base : 0x%llx\n", (uint64_t) t->iomap_base);
801 V3_Print(core->vm_info, core," (following io permission bitmap not currently printed)\n");
805 void v3_print_gp_error(struct guest_info * core, addr_t exit_info1) {
806 struct selector_error_code * error = (struct selector_error_code *)(&exit_info1);
808 if (v3_get_vm_cpu_mode(core)!=LONG) {
809 V3_Print(core->vm_info, core, "= IDT ========\n");
810 V3_Print(core->vm_info, core, "(currently only supported in long mode)\n");
814 V3_Print(core->vm_info, core, " selector index: %x, TI: %x, IDT: %x, EXT: %x (error=%llx)\n",
815 error->index, error->ti, error->idt, error->ext,
816 (unsigned long long)exit_info1);