From: Jack Lange Date: Wed, 22 Oct 2008 16:08:53 +0000 (-0500) Subject: fixed all the printf style warnings/errors X-Git-Tag: 1.0^2~12 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=8c767ddb04d3ac42d080d9f9f5f40196d6f8f217 fixed all the printf style warnings/errors --- diff --git a/palacios/src/devices/serial.c b/palacios/src/devices/serial.c index c4c52da..7468493 100644 --- a/palacios/src/devices/serial.c +++ b/palacios/src/devices/serial.c @@ -289,7 +289,7 @@ static int write_ctrl_port(ushort_t port, void * src, uint_t length, struct vm_d PrintDebug("Write to Control Port (val=%x)\n", *(char *)src); if (length != 1) { - PrintDebug("Invalid Write length to control port\n", port, port); + PrintDebug("Invalid Write length to control port %d\n", port); return -1; } diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index b9f4a9f..40dded0 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -234,7 +234,7 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info *vm_info) { // Enable Nested Paging ctrl_area->NP_ENABLE = 1; - PrintDebug("NP_Enable at 0x%x\n", &(ctrl_area->NP_ENABLE)); + PrintDebug("NP_Enable at 0x%p\n", (void *)&(ctrl_area->NP_ENABLE)); // Set the Nested Page Table pointer vm_info->direct_map_pt = ((addr_t)create_passthrough_pde32_pts(vm_info) & ~0xfff); @@ -264,7 +264,7 @@ static int init_svm_guest(struct guest_info *info) { // PrintDebugPageTables(info->page_tables); - PrintDebug("Initializing VMCB (addr=%x)\n", info->vmm_data); + PrintDebug("Initializing VMCB (addr=%p)\n", (void *)info->vmm_data); Init_VMCB_BIOS((vmcb_t*)(info->vmm_data), info); @@ -294,7 +294,7 @@ static int start_svm_guest(struct guest_info *info) { - PrintDebug("Launching SVM VM (vmcb=%x)\n", info->vmm_data); + PrintDebug("Launching SVM VM (vmcb=%p)\n", (void *)info->vmm_data); //PrintDebugVMCB((vmcb_t*)(info->vmm_data)); info->run_state = VM_RUNNING; @@ -308,7 +308,7 @@ static int start_svm_guest(struct guest_info *info) { v3_clgi(); - PrintDebug("SVM Entry to rip=%x...\n", info->rip); + PrintDebug("SVM Entry to rip=%p...\n", (void *)info->rip); v3_get_msr(0xc0000101, &vm_cr_high, &vm_cr_low); @@ -323,10 +323,12 @@ static int start_svm_guest(struct guest_info *info) { PrintDebug("SVM Returned\n"); +#if PrintDebug { uint_t x = 0; - PrintDebug("RSP=%p\n", &x); + PrintDebug("RSP=%p\n", (void *)&x); } +#endif v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); @@ -349,13 +351,13 @@ static int start_svm_guest(struct guest_info *info) { PrintDebug("SVM ERROR!!\n"); - PrintDebug("RIP: %x\n", guest_state->rip); + PrintDebug("RIP: %p\n", (void *)guest_state->rip); linear_addr = get_addr_linear(info, guest_state->rip, &(info->segments.cs)); - PrintDebug("RIP Linear: %\n", linear_addr); + PrintDebug("RIP Linear: %p\n", (void *)linear_addr); v3_print_segments(info); v3_print_ctrl_regs(info); v3_print_GPRs(info); @@ -367,9 +369,9 @@ static int start_svm_guest(struct guest_info *info) { } - PrintDebug("Host Address of rip = 0x%x\n", host_addr); + PrintDebug("Host Address of rip = 0x%p\n", (void *)host_addr); - PrintDebug("Instr (15 bytes) at %x:\n", host_addr); + PrintDebug("Instr (15 bytes) at %p:\n", (void *)host_addr); PrintTraceMemDump((uchar_t *)host_addr, 15); break; @@ -393,7 +395,7 @@ int v3_is_svm_capable() { v3_cpuid(CPUID_FEATURE_IDS, &eax, &ebx, &ecx, &edx); - PrintDebug("CPUID_FEATURE_IDS_ecx=0x%x\n", ecx); + PrintDebug("CPUID_FEATURE_IDS_ecx=0x%p\n", (void *)ecx); if ((ecx & CPUID_FEATURE_IDS_ecx_svm_avail) == 0) { PrintDebug("SVM Not Available\n"); @@ -408,7 +410,7 @@ int v3_is_svm_capable() { v3_cpuid(CPUID_SVM_REV_AND_FEATURE_IDS, &eax, &ebx, &ecx, &edx); - PrintDebug("CPUID_FEATURE_IDS_edx=0x%x\n", edx); + PrintDebug("CPUID_FEATURE_IDS_edx=0x%p\n", (void *)edx); if ((edx & CPUID_SVM_REV_AND_FEATURE_IDS_edx_svml) == 0) { PrintDebug("SVM BIOS Disabled, not unlockable\n"); @@ -422,7 +424,7 @@ int v3_is_svm_capable() { v3_cpuid(CPUID_SVM_REV_AND_FEATURE_IDS, &eax, &ebx, &ecx, &edx); - PrintDebug("CPUID_FEATURE_IDS_edx=0x%x\n", edx); + PrintDebug("CPUID_FEATURE_IDS_edx=0x%p\n", (void *)edx); if ((edx & CPUID_SVM_REV_AND_FEATURE_IDS_edx_np) == 0) { PrintDebug("SVM Nested Paging not supported\n"); @@ -519,7 +521,7 @@ void v3_init_SVM(struct v3_ctrl_ops * vmm_ops) { //msr.e_reg.low = (uint_t)host_state; msr.r_reg = (addr_t)host_state; - PrintDebug("Host State being saved at %x\n", (addr_t)host_state); + PrintDebug("Host State being saved at %p\n", (void *)(addr_t)host_state); v3_set_msr(SVM_VM_HSAVE_PA_MSR, msr.e_reg.high, msr.e_reg.low); diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index 2cfe74e..a2b942f 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -83,7 +83,7 @@ int v3_handle_svm_exit(struct guest_info * info) { // Dump out the instr stream //PrintDebug("RIP: %x\n", guest_state->rip); - PrintDebug("RIP Linear: %x\n", get_addr_linear(info, info->rip, &(info->segments.cs))); + PrintDebug("RIP Linear: %p\n", (void *)get_addr_linear(info, info->rip, &(info->segments.cs))); // OK, now we will read the instruction // The only difference between PROTECTED and PROTECTED_PG is whether we read @@ -337,11 +337,11 @@ int v3_handle_svm_exit(struct guest_info * info) { rip_addr = get_addr_linear(info, guest_state->rip, &(info->segments.cs)); - PrintError("SVM Returned:(VMCB=%x)\n", info->vmm_data); - PrintError("RIP: %x\n", guest_state->rip); - PrintError("RIP Linear: %x\n", rip_addr); + PrintError("SVM Returned:(VMCB=%p)\n", (void *)(info->vmm_data)); + PrintError("RIP: %p\n", (void *)(guest_state->rip)); + PrintError("RIP Linear: %p\n", (void *)(rip_addr)); - PrintError("SVM Returned: Exit Code: %x\n", exit_code); + PrintError("SVM Returned: Exit Code: %p\n", (void *)exit_code); PrintError("io_info1 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info1)); PrintError("io_info1 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info1)) + 4)); @@ -366,11 +366,11 @@ int v3_handle_svm_exit(struct guest_info * info) { return -1; } - PrintError("Host Address of rip = 0x%x\n", host_addr); + PrintError("Host Address of rip = 0x%p\n", (void *)host_addr); memset(buf, 0, 32); - PrintError("Reading instruction stream in guest\n", rip_addr); + PrintError("Reading instruction stream in guest (addr=%p)\n", (void *)rip_addr); if (info->mem_mode == PHYSICAL_MEM) { read_guest_pa_memory(info, rip_addr - 16, 32, buf); diff --git a/palacios/src/palacios/vm_guest.c b/palacios/src/palacios/vm_guest.c index b9e49d2..5b7c39f 100644 --- a/palacios/src/palacios/vm_guest.c +++ b/palacios/src/palacios/vm_guest.c @@ -89,7 +89,8 @@ void v3_print_segments(struct guest_info * info) { for (i = 0; seg_names[i] != NULL; i++) { - PrintDebug("\t%s: Sel=%x, base=%x, limit=%x\n", seg_names[i], seg_ptr[i].selector, seg_ptr[i].base, seg_ptr[i].limit); + PrintDebug("\t%s: Sel=%x, base=%p, limit=%x\n", seg_names[i], seg_ptr[i].selector, + (void *)seg_ptr[i].base, seg_ptr[i].limit); } @@ -107,7 +108,7 @@ void v3_print_ctrl_regs(struct guest_info * info) { PrintDebug("32 bit Ctrl Regs:\n"); for (i = 0; reg_names[i] != NULL; i++) { - PrintDebug("\t%s=0x%x\n", reg_names[i], reg_ptr[i]); + PrintDebug("\t%s=0x%p\n", reg_names[i], (void *)reg_ptr[i]); } } @@ -123,6 +124,6 @@ void v3_print_GPRs(struct guest_info * info) { PrintDebug("32 bit GPRs:\n"); for (i = 0; reg_names[i] != NULL; i++) { - PrintDebug("\t%s=0x%x\n", reg_names[i], reg_ptr[i]); + PrintDebug("\t%s=0x%p\n", reg_names[i], (void *)reg_ptr[i]); } } diff --git a/palacios/src/palacios/vm_guest_mem.c b/palacios/src/palacios/vm_guest_mem.c index 51393d6..32d4ab6 100644 --- a/palacios/src/palacios/vm_guest_mem.c +++ b/palacios/src/palacios/vm_guest_mem.c @@ -34,7 +34,8 @@ int host_va_to_host_pa(addr_t host_va, addr_t * host_pa) { *host_pa = (addr_t)(os_hooks)->vaddr_to_paddr((void *)host_va); if (*host_pa == 0) { - PrintError("In HVA->HPA: Invalid HVA(%x)->HPA lookup\n", host_va); + PrintError("In HVA->HPA: Invalid HVA(%p)->HPA lookup\n", + (void *)host_va); return -1; } } else { @@ -51,7 +52,8 @@ int host_pa_to_host_va(addr_t host_pa, addr_t * host_va) { *host_va = (addr_t)(os_hooks)->paddr_to_vaddr((void *)host_pa); if (*host_va == 0) { - PrintError("In HPA->HVA: Invalid HPA(%x)->HVA lookup\n", host_pa); + PrintError("In HPA->HVA: Invalid HPA(%p)->HVA lookup\n", + (void *)host_pa); return -1; } } else { @@ -65,8 +67,11 @@ int host_pa_to_host_va(addr_t host_pa, addr_t * host_va) { int guest_pa_to_host_pa(struct guest_info * guest_info, addr_t guest_pa, addr_t * host_pa) { // we use the shadow map here... - if (lookup_shadow_map_addr(&(guest_info->mem_map), guest_pa, host_pa) != HOST_REGION_PHYSICAL_MEMORY) { - PrintError("In GPA->HPA: Could not find address in shadow map (addr=%x)\n", guest_pa); + host_region_type_t reg_type = lookup_shadow_map_addr(&(guest_info->mem_map), guest_pa, host_pa); + + if (reg_type != HOST_REGION_PHYSICAL_MEMORY) { + PrintError("In GPA->HPA: Could not find address in shadow map (addr=%p) (reg_type=%d)\n", + (void *)guest_pa, reg_type); return -1; } @@ -99,12 +104,14 @@ int host_va_to_guest_pa(struct guest_info * guest_info, addr_t host_va, addr_t * *guest_pa = 0; if (host_va_to_host_pa(host_va, &host_pa) != 0) { - PrintError("In HVA->GPA: Invalid HVA(%x)->HPA lookup\n", host_va); + PrintError("In HVA->GPA: Invalid HVA(%p)->HPA lookup\n", + (void *)host_va); return -1; } if (host_pa_to_guest_pa(guest_info, host_pa, guest_pa) != 0) { - PrintError("In HVA->GPA: Invalid HPA(%x)->GPA lookup\n", host_pa); + PrintError("In HVA->GPA: Invalid HPA(%p)->GPA lookup\n", + (void *)host_pa); return -1; } @@ -120,12 +127,14 @@ int guest_pa_to_host_va(struct guest_info * guest_info, addr_t guest_pa, addr_t *host_va = 0; if (guest_pa_to_host_pa(guest_info, guest_pa, &host_pa) != 0) { - PrintError("In GPA->HVA: Invalid GPA(%x)->HPA lookup\n", guest_pa); + PrintError("In GPA->HVA: Invalid GPA(%p)->HPA lookup\n", + (void *)guest_pa); return -1; } if (host_pa_to_host_va(host_pa, host_va) != 0) { - PrintError("In GPA->HVA: Invalid HPA(%x)->HVA lookup\n", host_pa); + PrintError("In GPA->HVA: Invalid HPA(%p)->HVA lookup\n", + (void *)host_pa); return -1; } @@ -157,7 +166,8 @@ int guest_va_to_guest_pa(struct guest_info * guest_info, addr_t guest_va, addr_t } if (guest_pa_to_host_va(guest_info, guest_pde, (addr_t *)&pde) == -1) { - PrintError("In GVA->GPA: Invalid GPA(%x)->HVA PDE32 lookup\n", guest_pde); + PrintError("In GVA->GPA: Invalid GPA(%p)->HVA PDE32 lookup\n", + (void *)guest_pde); return -1; } @@ -175,14 +185,16 @@ int guest_va_to_guest_pa(struct guest_info * guest_info, addr_t guest_va, addr_t if (guest_pa_to_host_va(guest_info, tmp_pa, (addr_t*)&pte) == -1) { - PrintError("In GVA->GPA: Invalid GPA(%x)->HVA PTE32 lookup\n", guest_pa); + PrintError("In GVA->GPA: Invalid GPA(%p)->HVA PTE32 lookup\n", + (void *)guest_pa); return -1; } //PrintDebug("PTE host addr=%x, GVA=%x, GPA=%x(should be 0)\n", pte, guest_va, *guest_pa); if (pte32_lookup(pte, guest_va, guest_pa) != 0) { - PrintError("In GVA->GPA: PTE32 Lookup failure GVA=%x; PTE=%x\n", guest_va, pte); + PrintError("In GVA->GPA: PTE32 Lookup failure GVA=%p; PTE=%p\n", + (void *)guest_va, (void *)pte); // PrintPT32(PDE32_INDEX(guest_va) << 22, pte); return -1; } @@ -235,12 +247,14 @@ int guest_va_to_host_pa(struct guest_info * guest_info, addr_t guest_va, addr_t *host_pa = 0; if (guest_va_to_guest_pa(guest_info, guest_va, &guest_pa) != 0) { - PrintError("In GVA->HPA: Invalid GVA(%x)->GPA lookup\n", guest_va); + PrintError("In GVA->HPA: Invalid GVA(%p)->GPA lookup\n", + (void *)guest_va); return -1; } if (guest_pa_to_host_pa(guest_info, guest_pa, host_pa) != 0) { - PrintError("In GVA->HPA: Invalid GPA(%x)->HPA lookup\n", guest_pa); + PrintError("In GVA->HPA: Invalid GPA(%p)->HPA lookup\n", + (void *)guest_pa); return -1; } @@ -254,12 +268,14 @@ int host_pa_to_guest_va(struct guest_info * guest_info, addr_t host_pa, addr_t * *guest_va = 0; if (host_pa_to_guest_pa(guest_info, host_pa, &guest_pa) != 0) { - PrintError("In HPA->GVA: Invalid HPA(%x)->GPA lookup\n", host_pa); + PrintError("In HPA->GVA: Invalid HPA(%p)->GPA lookup\n", + (void *)host_pa); return -1; } if (guest_pa_to_guest_va(guest_info, guest_pa, guest_va) != 0) { - PrintError("In HPA->GVA: Invalid GPA(%x)->GVA lookup\n", guest_pa); + PrintError("In HPA->GVA: Invalid GPA(%p)->GVA lookup\n", + (void *)guest_pa); return -1; } @@ -276,17 +292,20 @@ int guest_va_to_host_va(struct guest_info * guest_info, addr_t guest_va, addr_t *host_va = 0; if (guest_va_to_guest_pa(guest_info, guest_va, &guest_pa) != 0) { - PrintError("In GVA->HVA: Invalid GVA(%x)->GPA lookup\n", guest_va); + PrintError("In GVA->HVA: Invalid GVA(%p)->GPA lookup\n", + (void *)guest_va); return -1; } if (guest_pa_to_host_pa(guest_info, guest_pa, &host_pa) != 0) { - PrintError("In GVA->HVA: Invalid GPA(%x)->HPA lookup\n", guest_pa); + PrintError("In GVA->HVA: Invalid GPA(%p)->HPA lookup\n", + (void *)guest_pa); return -1; } if (host_pa_to_host_va(host_pa, host_va) != 0) { - PrintError("In GVA->HVA: Invalid HPA(%x)->HVA lookup\n", host_pa); + PrintError("In GVA->HVA: Invalid HPA(%p)->HVA lookup\n", + (void *)host_pa); return -1; } @@ -302,17 +321,20 @@ int host_va_to_guest_va(struct guest_info * guest_info, addr_t host_va, addr_t * *guest_va = 0; if (host_va_to_host_pa(host_va, &host_pa) != 0) { - PrintError("In HVA->GVA: Invalid HVA(%x)->HPA lookup\n", host_va); + PrintError("In HVA->GVA: Invalid HVA(%p)->HPA lookup\n", + (void *)host_va); return -1; } if (host_pa_to_guest_pa(guest_info, host_pa, &guest_pa) != 0) { - PrintError("In HVA->GVA: Invalid HPA(%x)->GPA lookup\n", host_va); + PrintError("In HVA->GVA: Invalid HPA(%p)->GPA lookup\n", + (void *)host_va); return -1; } if (guest_pa_to_guest_va(guest_info, guest_pa, guest_va) != 0) { - PrintError("In HVA->GVA: Invalid GPA(%x)->GVA lookup\n", guest_pa); + PrintError("In HVA->GVA: Invalid GPA(%p)->GVA lookup\n", + (void *)guest_pa); return -1; } @@ -340,7 +362,7 @@ int read_guest_va_memory(struct guest_info * guest_info, addr_t guest_va, int co if (guest_va_to_host_va(guest_info, cursor, &host_addr) != 0) { - PrintDebug("Invalid GVA(%x)->HVA lookup\n", cursor); + PrintDebug("Invalid GVA(%p)->HVA lookup\n", (void *)cursor); return bytes_read; } diff --git a/palacios/src/palacios/vmcb.c b/palacios/src/palacios/vmcb.c index a2eae49..7e3317f 100644 --- a/palacios/src/palacios/vmcb.c +++ b/palacios/src/palacios/vmcb.c @@ -91,7 +91,7 @@ void PrintDebugVMCB(vmcb_t * vmcb) { vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA(vmcb); vmcb_saved_state_t * guest_area = GET_VMCB_SAVE_STATE_AREA(vmcb); - PrintDebug("VMCB (0x%.8x)\n", vmcb); + PrintDebug("VMCB (0x%p)\n", (void *)vmcb); PrintDebug("--Control Area--\n"); PrintDebug("CR Reads: %x\n", *(ushort_t*)&(ctrl_area->cr_reads)); @@ -99,7 +99,7 @@ void PrintDebugVMCB(vmcb_t * vmcb) { PrintDebug("DR Reads: %x\n", *(ushort_t*)&(ctrl_area->dr_reads)); PrintDebug("DR Writes: %x\n", *(ushort_t*)&(ctrl_area->dr_writes)); - PrintDebug("Exception Bitmap: %x (at 0x%.8x)\n", *(uint_t*)&(ctrl_area->exceptions), &(ctrl_area->exceptions)); + PrintDebug("Exception Bitmap: %x (at 0x%p)\n", *(uint_t*)&(ctrl_area->exceptions), (void *)&(ctrl_area->exceptions)); PrintDebug("\tDivide-by-Zero: %d\n", ctrl_area->exceptions.de); PrintDebug("\tDebug: %d\n", ctrl_area->exceptions.db); PrintDebug("\tNon-maskable interrupts: %d\n", ctrl_area->exceptions.nmi); @@ -120,7 +120,7 @@ void PrintDebugVMCB(vmcb_t * vmcb) { PrintDebug("\tSIMD floating point: %d\n", ctrl_area->exceptions.xf); PrintDebug("\tSecurity: %d\n", ctrl_area->exceptions.sx); - PrintDebug("Instructions bitmap: %.8x (at 0x%.8x)\n", *(uint_t*)&(ctrl_area->instrs), &(ctrl_area->instrs)); + PrintDebug("Instructions bitmap: %.8x (at 0x%p)\n", *(uint_t*)&(ctrl_area->instrs), &(ctrl_area->instrs)); PrintDebug("\tINTR: %d\n", ctrl_area->instrs.INTR); PrintDebug("\tNMI: %d\n", ctrl_area->instrs.NMI); PrintDebug("\tSMI: %d\n", ctrl_area->instrs.SMI); @@ -154,7 +154,7 @@ void PrintDebugVMCB(vmcb_t * vmcb) { PrintDebug("\tFERR_FREEZE: %d\n", ctrl_area->instrs.FERR_FREEZE); PrintDebug("\tshutdown_evts: %d\n", ctrl_area->instrs.shutdown_evts); - PrintDebug("SVM Instruction Bitmap: %.8x (at 0x%.8x)\n", *(uint_t*)&(ctrl_area->svm_instrs), &(ctrl_area->svm_instrs)); + PrintDebug("SVM Instruction Bitmap: %x (at 0x%p)\n", *(uint_t*)&(ctrl_area->svm_instrs), &(ctrl_area->svm_instrs)); PrintDebug("\tVMRUN: %d\n", ctrl_area->svm_instrs.VMRUN); PrintDebug("\tVMMCALL: %d\n", ctrl_area->svm_instrs.VMMCALL); PrintDebug("\tVMLOAD: %d\n", ctrl_area->svm_instrs.VMLOAD); @@ -172,17 +172,17 @@ void PrintDebugVMCB(vmcb_t * vmcb) { tmp_reg.r_reg = ctrl_area->IOPM_BASE_PA; - PrintDebug("IOPM_BASE_PA: lo: 0x%.8x, hi: 0x%.8x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high); + PrintDebug("IOPM_BASE_PA: lo: 0x%x, hi: 0x%x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high); tmp_reg.r_reg = ctrl_area->MSRPM_BASE_PA; - PrintDebug("MSRPM_BASE_PA: lo: 0x%.8x, hi: 0x%.8x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high); + PrintDebug("MSRPM_BASE_PA: lo: 0x%x, hi: 0x%x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high); tmp_reg.r_reg = ctrl_area->TSC_OFFSET; - PrintDebug("TSC_OFFSET: lo: 0x%.8x, hi: 0x%.8x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high); + PrintDebug("TSC_OFFSET: lo: 0x%x, hi: 0x%x\n", tmp_reg.e_reg.low, tmp_reg.e_reg.high); PrintDebug("guest_ASID: %d\n", ctrl_area->guest_ASID); PrintDebug("TLB_CONTROL: %d\n", ctrl_area->TLB_CONTROL); - PrintDebug("Guest Control Bitmap: %x (at 0x%.8x)\n", *(uint_t*)&(ctrl_area->guest_ctrl), &(ctrl_area->guest_ctrl)); + PrintDebug("Guest Control Bitmap: %x (at 0x%p)\n", *(uint_t*)&(ctrl_area->guest_ctrl), &(ctrl_area->guest_ctrl)); PrintDebug("\tV_TPR: %d\n", ctrl_area->guest_ctrl.V_TPR); PrintDebug("\tV_IRQ: %d\n", ctrl_area->guest_ctrl.V_IRQ); PrintDebug("\tV_INTR_PRIO: %d\n", ctrl_area->guest_ctrl.V_INTR_PRIO); @@ -194,14 +194,14 @@ void PrintDebugVMCB(vmcb_t * vmcb) { tmp_reg.r_reg = ctrl_area->exit_code; - PrintDebug("exit_code: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("exit_code: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = ctrl_area->exit_info1; - PrintDebug("exit_info1: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("exit_info1: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = ctrl_area->exit_info2; - PrintDebug("exit_info2: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("exit_info2: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("Exit Int Info: (at 0x%.8x)\n", &(ctrl_area->exit_int_info)); + PrintDebug("Exit Int Info: (at 0x%p)\n", &(ctrl_area->exit_int_info)); PrintDebug("Vector: %d\n", ctrl_area->exit_int_info.vector); PrintDebug("(type=%d) (ev=%d) (valid=%d)\n", ctrl_area->exit_int_info.type, ctrl_area->exit_int_info.ev, ctrl_area->exit_int_info.valid); @@ -209,9 +209,9 @@ void PrintDebugVMCB(vmcb_t * vmcb) { tmp_reg.r_reg = ctrl_area->NP_ENABLE; - PrintDebug("NP_ENABLE: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("NP_ENABLE: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("Event Injection: (at 0x%.8x)\n", &(ctrl_area->EVENTINJ)); + PrintDebug("Event Injection: (at 0x%p)\n", &(ctrl_area->EVENTINJ)); PrintDebug("Vector: %d\n", ctrl_area->EVENTINJ.vector); PrintDebug("(type=%d) (ev=%d) (valid=%d)\n", ctrl_area->EVENTINJ.type, ctrl_area->EVENTINJ.ev, ctrl_area->EVENTINJ.valid); @@ -219,192 +219,192 @@ void PrintDebugVMCB(vmcb_t * vmcb) { tmp_reg.r_reg = ctrl_area->N_CR3; - PrintDebug("N_CR3: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("N_CR3: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); PrintDebug("LBR_VIRTUALIZATION_ENABLE: %d\n", ctrl_area->LBR_VIRTUALIZATION_ENABLE); PrintDebug("\n--Guest Saved State--\n"); - PrintDebug("es Selector (at 0x%.8x): \n", &(guest_area->es)); + PrintDebug("es Selector (at 0x%p): \n", &(guest_area->es)); PrintDebug("\tSelector: %d\n", guest_area->es.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->es.attrib.fields.type, guest_area->es.attrib.fields.S, guest_area->es.attrib.fields.dpl, guest_area->es.attrib.fields.P, guest_area->es.attrib.fields.avl, guest_area->es.attrib.fields.L, guest_area->es.attrib.fields.db, guest_area->es.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->es.limit); + PrintDebug("\tlimit: %u\n", guest_area->es.limit); tmp_reg.r_reg = guest_area->es.base; - PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("cs Selector (at 0x%.8x): \n", &(guest_area->cs)); + PrintDebug("cs Selector (at 0x%p): \n", &(guest_area->cs)); PrintDebug("\tSelector: %d\n", guest_area->cs.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->cs.attrib.fields.type, guest_area->cs.attrib.fields.S, guest_area->cs.attrib.fields.dpl, guest_area->cs.attrib.fields.P, guest_area->cs.attrib.fields.avl, guest_area->cs.attrib.fields.L, guest_area->cs.attrib.fields.db, guest_area->cs.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->cs.limit); + PrintDebug("\tlimit: %u\n", guest_area->cs.limit); tmp_reg.r_reg = guest_area->cs.base; - PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("ss Selector (at 0x%.8x): \n", &(guest_area->ss)); + PrintDebug("ss Selector (at 0x%p): \n", &(guest_area->ss)); PrintDebug("\tSelector: %d\n", guest_area->ss.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->ss.attrib.fields.type, guest_area->ss.attrib.fields.S, guest_area->ss.attrib.fields.dpl, guest_area->ss.attrib.fields.P, guest_area->ss.attrib.fields.avl, guest_area->ss.attrib.fields.L, guest_area->ss.attrib.fields.db, guest_area->ss.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->ss.limit); + PrintDebug("\tlimit: %u\n", guest_area->ss.limit); tmp_reg.r_reg = guest_area->ss.base; - PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("ds Selector (at 0x%.8x): \n", &(guest_area->ds)); + PrintDebug("ds Selector (at 0x%p): \n", &(guest_area->ds)); PrintDebug("\tSelector: %d\n", guest_area->ds.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->ds.attrib.fields.type, guest_area->ds.attrib.fields.S, guest_area->ds.attrib.fields.dpl, guest_area->ds.attrib.fields.P, guest_area->ds.attrib.fields.avl, guest_area->ds.attrib.fields.L, guest_area->ds.attrib.fields.db, guest_area->ds.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->ds.limit); + PrintDebug("\tlimit: %u\n", guest_area->ds.limit); tmp_reg.r_reg = guest_area->ds.base; - PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("fs Selector (at 0x%.8x): \n", &(guest_area->fs)); + PrintDebug("fs Selector (at 0x%p): \n", &(guest_area->fs)); PrintDebug("\tSelector: %d\n", guest_area->fs.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->fs.attrib.fields.type, guest_area->fs.attrib.fields.S, guest_area->fs.attrib.fields.dpl, guest_area->fs.attrib.fields.P, guest_area->fs.attrib.fields.avl, guest_area->fs.attrib.fields.L, guest_area->fs.attrib.fields.db, guest_area->fs.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->fs.limit); + PrintDebug("\tlimit: %u\n", guest_area->fs.limit); tmp_reg.r_reg = guest_area->fs.base; - PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("gs Selector (at 0x%.8x): \n", &(guest_area->gs)); + PrintDebug("gs Selector (at 0x%p): \n", &(guest_area->gs)); PrintDebug("\tSelector: %d\n", guest_area->gs.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->gs.attrib.fields.type, guest_area->gs.attrib.fields.S, guest_area->gs.attrib.fields.dpl, guest_area->gs.attrib.fields.P, guest_area->gs.attrib.fields.avl, guest_area->gs.attrib.fields.L, guest_area->gs.attrib.fields.db, guest_area->gs.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->gs.limit); + PrintDebug("\tlimit: %u\n", guest_area->gs.limit); tmp_reg.r_reg = guest_area->gs.base; - PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("gdtr Selector (at 0x%.8x): \n", &(guest_area->gdtr)); + PrintDebug("gdtr Selector (at 0x%p): \n", &(guest_area->gdtr)); PrintDebug("\tSelector: %d\n", guest_area->gdtr.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->gdtr.attrib.fields.type, guest_area->gdtr.attrib.fields.S, guest_area->gdtr.attrib.fields.dpl, guest_area->gdtr.attrib.fields.P, guest_area->gdtr.attrib.fields.avl, guest_area->gdtr.attrib.fields.L, guest_area->gdtr.attrib.fields.db, guest_area->gdtr.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->gdtr.limit); + PrintDebug("\tlimit: %u\n", guest_area->gdtr.limit); tmp_reg.r_reg = guest_area->gdtr.base; PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("ldtr Selector (at 0x%.8x): \n", &(guest_area->ldtr)); + PrintDebug("ldtr Selector (at 0x%p): \n", &(guest_area->ldtr)); PrintDebug("\tSelector: %d\n", guest_area->ldtr.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->ldtr.attrib.fields.type, guest_area->ldtr.attrib.fields.S, guest_area->ldtr.attrib.fields.dpl, guest_area->ldtr.attrib.fields.P, guest_area->ldtr.attrib.fields.avl, guest_area->ldtr.attrib.fields.L, guest_area->ldtr.attrib.fields.db, guest_area->ldtr.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->ldtr.limit); + PrintDebug("\tlimit: %u\n", guest_area->ldtr.limit); tmp_reg.r_reg = guest_area->ldtr.base; PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("idtr Selector (at 0x%.8x): \n", &(guest_area->idtr)); + PrintDebug("idtr Selector (at 0x%p): \n", &(guest_area->idtr)); PrintDebug("\tSelector: %d\n", guest_area->idtr.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->idtr.attrib.fields.type, guest_area->idtr.attrib.fields.S, guest_area->idtr.attrib.fields.dpl, guest_area->idtr.attrib.fields.P, guest_area->idtr.attrib.fields.avl, guest_area->idtr.attrib.fields.L, guest_area->idtr.attrib.fields.db, guest_area->idtr.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->idtr.limit); + PrintDebug("\tlimit: %u\n", guest_area->idtr.limit); tmp_reg.r_reg = guest_area->idtr.base; - PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); - PrintDebug("tr Selector (at 0x%.8x): \n", &(guest_area->tr)); + PrintDebug("tr Selector (at 0x%p): \n", &(guest_area->tr)); PrintDebug("\tSelector: %d\n", guest_area->tr.selector); PrintDebug("\t(type=%x), (S=%d), (dpl=%d), (P=%d), (avl=%d), (L=%d), (db=%d), (G=%d)\n", guest_area->tr.attrib.fields.type, guest_area->tr.attrib.fields.S, guest_area->tr.attrib.fields.dpl, guest_area->tr.attrib.fields.P, guest_area->tr.attrib.fields.avl, guest_area->tr.attrib.fields.L, guest_area->tr.attrib.fields.db, guest_area->tr.attrib.fields.G); - PrintDebug("\tlimit: %lu\n", guest_area->tr.limit); + PrintDebug("\tlimit: %u\n", guest_area->tr.limit); tmp_reg.r_reg = guest_area->tr.base; - PrintDebug("\tBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("\tBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); PrintDebug("cpl: %d\n", guest_area->cpl); tmp_reg.r_reg = guest_area->efer; - PrintDebug("EFER: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("EFER: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->cr4; - PrintDebug("CR4: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("CR4: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->cr3; - PrintDebug("CR3: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("CR3: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->cr0; - PrintDebug("CR0: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("CR0: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->dr7; - PrintDebug("DR7: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("DR7: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->dr6; - PrintDebug("DR6: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("DR6: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->rflags; - PrintDebug("RFLAGS: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("RFLAGS: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->rip; - PrintDebug("RIP: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("RIP: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->rsp; - PrintDebug("RSP: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("RSP: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->rax; - PrintDebug("RAX: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("RAX: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->star; - PrintDebug("STAR: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("STAR: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->lstar; - PrintDebug("LSTAR: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("LSTAR: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->cstar; - PrintDebug("CSTAR: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("CSTAR: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->sfmask; - PrintDebug("SFMASK: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("SFMASK: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->KernelGsBase; - PrintDebug("KernelGsBase: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("KernelGsBase: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->sysenter_cs; - PrintDebug("sysenter_cs: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("sysenter_cs: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->sysenter_esp; - PrintDebug("sysenter_esp: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("sysenter_esp: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->sysenter_eip; - PrintDebug("sysenter_eip: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("sysenter_eip: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->cr2; - PrintDebug("CR2: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("CR2: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->g_pat; - PrintDebug("g_pat: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("g_pat: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->dbgctl; - PrintDebug("dbgctl: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("dbgctl: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->br_from; - PrintDebug("br_from: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("br_from: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->br_to; - PrintDebug("br_to: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("br_to: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->lastexcpfrom; - PrintDebug("lastexcpfrom: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("lastexcpfrom: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); tmp_reg.r_reg = guest_area->lastexcpto; - PrintDebug("lastexcpto: hi: 0x%.8x, lo: 0x%.8x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); + PrintDebug("lastexcpto: hi: 0x%x, lo: 0x%x\n", tmp_reg.e_reg.high, tmp_reg.e_reg.low); diff --git a/palacios/src/palacios/vmm_config.c b/palacios/src/palacios/vmm_config.c index 37c5312..5114521 100644 --- a/palacios/src/palacios/vmm_config.c +++ b/palacios/src/palacios/vmm_config.c @@ -50,7 +50,7 @@ static int mem_test_read(addr_t guest_addr, void * dst, uint_t length, void * pr memcpy(dst, &foo, length); - PrintDebug("Passthrough mem read returning: %d (length=%d)\n", foo + (guest_addr & 0xfff), length); + PrintDebug("Passthrough mem read returning: %p (length=%d)\n", (void *)(foo + (guest_addr & 0xfff)), length); return length; } @@ -109,10 +109,10 @@ int v3_config_guest(struct guest_info * info, struct v3_vm_config * config_ptr) add_shadow_region_passthrough(info, ROMBIOS_START, ROMBIOS_START + (num_pages * PAGE_SIZE), (addr_t)guest_mem); - PrintDebug("Adding Shadow Region (0x%x-0x%x) -> 0x%x\n", - ROMBIOS_START, - ROMBIOS_START + (num_pages * PAGE_SIZE), - guest_mem); + PrintDebug("Adding Shadow Region (0x%p-0x%p) -> 0x%p\n", + (void *)ROMBIOS_START, + (void *)ROMBIOS_START + (num_pages * PAGE_SIZE), + (void *)guest_mem); } @@ -126,10 +126,10 @@ int v3_config_guest(struct guest_info * info, struct v3_vm_config * config_ptr) add_shadow_region_passthrough(info, VGABIOS_START, VGABIOS_START + (num_pages * PAGE_SIZE), (addr_t)guest_mem); - PrintDebug("Adding Shadow Region (0x%x-0x%x) -> 0x%x\n", - VGABIOS_START, - VGABIOS_START + (num_pages * PAGE_SIZE), - guest_mem); + PrintDebug("Adding Shadow Region (0x%p-0x%p) -> 0x%p\n", + (void *)VGABIOS_START, + (void *)VGABIOS_START + (num_pages * PAGE_SIZE), + (void *)guest_mem); } // diff --git a/palacios/src/palacios/vmm_debug.c b/palacios/src/palacios/vmm_debug.c index ed98acc..9865dd1 100644 --- a/palacios/src/palacios/vmm_debug.c +++ b/palacios/src/palacios/vmm_debug.c @@ -36,7 +36,7 @@ void PrintDebugMemDump(uchar_t *start, int n) int i, j; for (i = 0; i < n; i += 16) { - PrintDebug("%8x", (start + i)); + PrintDebug("%p", (void *)(start + i)); for (j = i; (j < (i + 16)) && (j < n); j += 2) { PrintDebug(" "); diff --git a/palacios/src/palacios/vmm_intr.c b/palacios/src/palacios/vmm_intr.c index 7e1527c..87fbcdb 100644 --- a/palacios/src/palacios/vmm_intr.c +++ b/palacios/src/palacios/vmm_intr.c @@ -102,10 +102,10 @@ int v3_hook_passthrough_irq(struct guest_info * info, uint_t irq) NULL); if (rc) { - PrintError("guest_irq_injection: failed to hook irq 0x%x (guest=0x%x)\n", irq, info); + PrintError("guest_irq_injection: failed to hook irq 0x%x (guest=0x%p)\n", irq, (void *)info); return -1; } else { - PrintDebug("guest_irq_injection: hooked irq 0x%x (guest=0x%x)\n", irq, info); + PrintDebug("guest_irq_injection: hooked irq 0x%x (guest=0x%p)\n", irq, (void *)info); return 0; } } diff --git a/palacios/src/palacios/vmm_mem.c b/palacios/src/palacios/vmm_mem.c index c10f446..b4a181f 100644 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@ -81,7 +81,7 @@ struct vmm_mem_hook * get_mem_hook(struct guest_info * info, addr_t guest_addr) struct shadow_region * region = get_shadow_region_by_addr(&(info->mem_map), guest_addr); if (region == NULL) { - PrintDebug("Could not find shadow region for addr: %x\n", guest_addr); + PrintDebug("Could not find shadow region for addr: %p\n", (void *)guest_addr); return NULL; } @@ -165,7 +165,8 @@ int add_shadow_region(struct shadow_map * map, { struct shadow_region * cursor = map->head; - PrintDebug("Adding Shadow Region: (0x%x-0x%x)\n", region->guest_start, region->guest_end); + PrintDebug("Adding Shadow Region: (0x%p-0x%p)\n", + (void *)region->guest_start, (void *)region->guest_end); if ((!cursor) || (cursor->guest_start >= region->guest_end)) { region->prev = NULL; @@ -306,7 +307,8 @@ void print_shadow_map(struct shadow_map * map) { PrintDebug("Memory Layout (regions: %d) \n", map->num_regions); while (cur) { - PrintDebug("%d: 0x%x - 0x%x (%s) -> ", i, cur->guest_start, cur->guest_end - 1, + PrintDebug("%d: 0x%p - 0x%p (%s) -> ", i, + (void *)cur->guest_start, (void *)(cur->guest_end - 1), cur->guest_type == GUEST_REGION_PHYSICAL_MEMORY ? "GUEST_REGION_PHYSICAL_MEMORY" : cur->guest_type == GUEST_REGION_NOTHING ? "GUEST_REGION_NOTHING" : cur->guest_type == GUEST_REGION_MEMORY_MAPPED_DEVICE ? "GUEST_REGION_MEMORY_MAPPED_DEVICE" : @@ -314,7 +316,7 @@ void print_shadow_map(struct shadow_map * map) { if (cur->host_type == HOST_REGION_PHYSICAL_MEMORY || cur->host_type == HOST_REGION_UNALLOCATED || cur->host_type == HOST_REGION_MEMORY_MAPPED_DEVICE) { - PrintDebug("0x%x", cur->host_addr); + PrintDebug("0x%p", (void *)(cur->host_addr)); } PrintDebug("(%s)\n", cur->host_type == HOST_REGION_PHYSICAL_MEMORY ? "HOST_REGION_PHYSICAL_MEMORY" : diff --git a/palacios/src/palacios/vmm_paging.c b/palacios/src/palacios/vmm_paging.c index e850f88..429c6d2 100644 --- a/palacios/src/palacios/vmm_paging.c +++ b/palacios/src/palacios/vmm_paging.c @@ -264,8 +264,8 @@ pde32_t * create_passthrough_pde32_pts(struct guest_info * guest_info) { void PrintPDE32(addr_t virtual_address, pde32_t * pde) { - PrintDebug("PDE %x -> %p : present=%x, writable=%x, user=%x, wt=%x, cd=%x, accessed=%x, reserved=%x, largePages=%x, globalPage=%x, kernelInfo=%x\n", - virtual_address, + PrintDebug("PDE %p -> %p : present=%x, writable=%x, user=%x, wt=%x, cd=%x, accessed=%x, reserved=%x, largePages=%x, globalPage=%x, kernelInfo=%x\n", + (void *)virtual_address, (void *)(addr_t) (pde->pt_base_addr << PAGE_POWER), pde->present, pde->writable, @@ -282,7 +282,7 @@ void PrintPDE32(addr_t virtual_address, pde32_t * pde) void PrintPTE32(addr_t virtual_address, pte32_t * pte) { PrintDebug("PTE %p -> %p : present=%x, writable=%x, user=%x, wt=%x, cd=%x, accessed=%x, dirty=%x, pteAttribute=%x, globalPage=%x, vmm_info=%x\n", - virtual_address, + (void *)virtual_address, (void*)(addr_t)(pte->page_base_addr << PAGE_POWER), pte->present, pte->writable, diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index 2f91b96..06d79f5 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -165,7 +165,7 @@ int v3_cache_page_tables32(struct guest_info * info, addr_t pde) { pte_cache = create_hashtable(0, &pte_hash_fn, &pte_equals); state->cached_ptes = pte_cache; - if (guest_pa_to_host_pa(info, pde, &pde_host_addr) == -1) { + if (guest_pa_to_host_va(info, pde, &pde_host_addr) == -1) { PrintError("Could not lookup host address of guest PDE\n"); return -1; } @@ -179,7 +179,7 @@ int v3_cache_page_tables32(struct guest_info * info, addr_t pde) { if ((tmp_pde[i].present) && (tmp_pde[i].large_page == 0)) { addr_t pte_host_addr; - if (guest_pa_to_host_pa(info, (addr_t)(PDE32_T_ADDR(tmp_pde[i])), &pte_host_addr) == -1) { + if (guest_pa_to_host_va(info, (addr_t)(PDE32_T_ADDR(tmp_pde[i])), &pte_host_addr) == -1) { PrintError("Could not lookup host address of guest PDE\n"); return -1; } @@ -359,7 +359,7 @@ static int handle_large_pagefault32(struct guest_info * info, } else { // Handle hooked pages as well as other special pages if (handle_special_page_fault(info, fault_addr, guest_fault_pa, error_code) == -1) { - PrintError("Special Page Fault handler returned error for address: %x\n", fault_addr); + PrintError("Special Page Fault handler returned error for address: %p\n", (void *)fault_addr); return -1; } } @@ -394,7 +394,7 @@ static int handle_shadow_pagefault32(struct guest_info * info, addr_t fault_addr PrintDebug("Shadow page fault handler\n"); if (guest_pa_to_host_va(info, guest_cr3, (addr_t*)&guest_pd) == -1) { - PrintError("Invalid Guest PDE Address: 0x%x\n", guest_cr3); + PrintError("Invalid Guest PDE Address: 0x%p\n", (void *)guest_cr3); return -1; } @@ -625,7 +625,7 @@ static int handle_shadow_pte32_fault(struct guest_info * info, } else { // Page fault handled by hook functions if (handle_special_page_fault(info, fault_addr, guest_pa, error_code) == -1) { - PrintError("Special Page fault handler returned error for address: %x\n", fault_addr); + PrintError("Special Page fault handler returned error for address: %p\n", (void *)fault_addr); return -1; } } @@ -679,7 +679,7 @@ int v3_handle_shadow_invlpg(struct guest_info * info) { ret = read_guest_va_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr); if (ret != 15) { - PrintError("Could not read instruction 0x%x (ret=%d)\n", info->rip, ret); + PrintError("Could not read instruction 0x%p (ret=%d)\n", (void *)(info->rip), ret); return -1; } @@ -701,7 +701,7 @@ int v3_handle_shadow_invlpg(struct guest_info * info) { pde32_t * guest_pd = NULL; if (guest_pa_to_host_va(info, guest_cr3, (addr_t*)&guest_pd) == -1) { - PrintError("Invalid Guest PDE Address: 0x%x\n", guest_cr3); + PrintError("Invalid Guest PDE Address: 0x%p\n", (void *)guest_cr3); return -1; } diff --git a/palacios/src/palacios/vmm_util.c b/palacios/src/palacios/vmm_util.c index 192b64f..029f9fd 100644 --- a/palacios/src/palacios/vmm_util.c +++ b/palacios/src/palacios/vmm_util.c @@ -48,7 +48,7 @@ void PrintTraceMemDump(uchar_t * start, int n) { int i, j; for (i = 0; i < n; i += 16) { - PrintTrace("%8x", (start + i)); + PrintTrace("%p", (void *)(start + i)); for (j = i; (j < (i + 16)) && (j < n); j += 2) { PrintTrace(" "); PrintTraceHex(*(uchar_t *)(start + j));