From: Jack Lange Date: Fri, 26 Jun 2009 22:35:31 +0000 (-0500) Subject: more cleanup X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=be2e1236b710115eb59f166a950f45710a15d2ef more cleanup --- diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 5220c83..c7da4a4 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -337,13 +337,14 @@ static int start_svm_guest(struct guest_info *info) { PrintDebug("exit_info2 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info2)); PrintDebug("exit_info2 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info2)) + 4)); + linear_addr = get_addr_linear(info, info->rip, &(info->segments.cs)); + if (info->mem_mode == PHYSICAL_MEM) { guest_pa_to_host_va(info, linear_addr, &host_addr); } else if (info->mem_mode == VIRTUAL_MEM) { guest_va_to_host_va(info, linear_addr, &host_addr); } - PrintDebug("Host Address of rip = 0x%p\n", (void *)host_addr); PrintDebug("Instr (15 bytes) at %p:\n", (void *)host_addr); @@ -442,11 +443,9 @@ void v3_init_SVM(struct v3_ctrl_ops * vmm_ops) { PrintDebug("SVM Enabled\n"); - // Setup the host state save area host_vmcb = V3_AllocPages(4); - /* 64-BIT-ISSUE */ // msr.e_reg.high = 0; //msr.e_reg.low = (uint_t)host_vmcb; @@ -455,8 +454,6 @@ void v3_init_SVM(struct v3_ctrl_ops * vmm_ops) { PrintDebug("Host State being saved at %p\n", (void *)(addr_t)host_vmcb); v3_set_msr(SVM_VM_HSAVE_PA_MSR, msr.e_reg.high, msr.e_reg.low); - - /* * Test VMSAVE/VMLOAD Latency */ @@ -486,12 +483,8 @@ void v3_init_SVM(struct v3_ctrl_ops * vmm_ops) { end <<= 32; end += end_lo; - PrintDebug("VMSave Cycle Latency: %d\n", (uint32_t)(end - start)); - - - __asm__ __volatile__ ( "rdtsc ; " "movl %%eax, %%esi ; " @@ -513,12 +506,7 @@ void v3_init_SVM(struct v3_ctrl_ops * vmm_ops) { PrintDebug("VMLoad Cycle Latency: %d\n", (uint32_t)(end - start)); - - - } - - /* End Latency Test */ if (has_svm_nested_paging() == 1) { diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index 3808ac2..a981c96 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -44,7 +44,6 @@ int v3_handle_svm_exit(struct guest_info * info) { guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data)); guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); - // Update the high level state info->rip = guest_state->rip; info->vm_regs.rsp = guest_state->rsp; @@ -52,7 +51,6 @@ int v3_handle_svm_exit(struct guest_info * info) { info->cpl = guest_state->cpl; - info->ctrl_regs.cr0 = guest_state->cr0; info->ctrl_regs.cr2 = guest_state->cr2; info->ctrl_regs.cr3 = guest_state->cr3; @@ -67,10 +65,8 @@ int v3_handle_svm_exit(struct guest_info * info) { info->cpu_mode = v3_get_vm_cpu_mode(info); info->mem_mode = v3_get_vm_mem_mode(info); - exit_code = guest_ctrl->exit_code; - // PrintDebug("SVM Exit: %s (rip=%p) (info1=%p)\n", vmexit_code_to_str(exit_code), // (void *)(addr_t)info->rip, (void *)(addr_t)guest_ctrl->exit_info1); @@ -101,12 +97,9 @@ int v3_handle_svm_exit(struct guest_info * info) { } - - // Disable printing io exits due to bochs debug messages //if (!((exit_code == VMEXIT_IOIO) && ((ushort_t)(guest_ctrl->exit_info1 >> 16) == 0x402))) { - - + if ((0) && (exit_code <= VMEXIT_EXCP14)) { uchar_t instr[32]; int ret; @@ -114,7 +107,7 @@ int v3_handle_svm_exit(struct guest_info * info) { //PrintDebug("RIP: %x\n", guest_state->rip); PrintDebug("\n\n\nRIP Linear: %p\n", (void *)get_addr_linear(info, info->rip, &(info->segments.cs))); - + v3_print_GPRs(info); v3_print_ctrl_regs(info); @@ -128,7 +121,6 @@ int v3_handle_svm_exit(struct guest_info * info) { } else { ret = read_guest_va_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 32, instr); } - if (ret != 32) { @@ -146,7 +138,7 @@ int v3_handle_svm_exit(struct guest_info * info) { rdtscll(info->profiler.start_time); } - + //PrintDebug("SVM Returned: Exit Code: %x\n",exit_code); switch (exit_code) { @@ -176,7 +168,6 @@ int v3_handle_svm_exit(struct guest_info * info) { return -1; } } - } break; } diff --git a/palacios/src/palacios/vm_guest.c b/palacios/src/palacios/vm_guest.c index be9778c..8a2e4d4 100644 --- a/palacios/src/palacios/vm_guest.c +++ b/palacios/src/palacios/vm_guest.c @@ -219,6 +219,7 @@ void v3_print_guest_state(struct guest_info * info) { #ifdef __V3_32BIT__ + void v3_print_GPRs(struct guest_info * info) { struct v3_gprs * regs = &(info->vm_regs); int i = 0; @@ -233,7 +234,9 @@ void v3_print_GPRs(struct guest_info * info) { PrintDebug("\t%s=0x%p\n", reg_names[i], (void *)(addr_t)reg_ptr[i]); } } + #elif __V3_64BIT__ + void v3_print_GPRs(struct guest_info * info) { struct v3_gprs * regs = &(info->vm_regs); int i = 0; @@ -250,6 +253,4 @@ void v3_print_GPRs(struct guest_info * info) { } } - - #endif