X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm.c;h=a95efa4edf5b0d92882f53d5183986b70e67bbae;hb=2b1f4ef19d766727f873476861c64339c8836a40;hp=ff61e57675ac5c2a3ef08af86f4cd64e4cdaf13d;hpb=28b1d0ae6db40cb3e1f5a9b3596b625d2f2af0e4;p=palacios.git diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index ff61e57..a95efa4 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -9,6 +9,7 @@ #include #include +#include extern struct vmm_os_hooks * os_hooks; @@ -142,15 +143,41 @@ int start_svm_guest(struct guest_info *info) { CLGI(); //PrintDebug("SVM Launch Args (vmcb=%x), (info=%x), (vm_regs=%x)\n", info->vmm_data, &(info->vm_regs)); - //PrintDebug("Launching to RIP: %x\n", info->rip); + PrintDebug("Launching to RIP: %x\n", info->rip); safe_svm_launch((vmcb_t*)(info->vmm_data), &(info->vm_regs)); //launch_svm((vmcb_t*)(info->vmm_data)); - // PrintDebug("SVM Returned\n"); + //PrintDebug("SVM Returned\n"); - STGI(); + + STGI(); + + if (handle_svm_exit(info) != 0) { - PrintDebug("SVM ERROR!!\n"); + vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); + addr_t host_addr; + addr_t linear_addr = 0; + + PrintDebug("SVM ERROR!!\n"); + + + PrintDebug("RIP: %x\n", guest_state->rip); + + if (info->cpu_mode == REAL) { + linear_addr = get_addr_linear(info, guest_state->rip, guest_state->cs.selector); + } else { + linear_addr = get_addr_linear(info, guest_state->rip, guest_state->cs.base); + } + + PrintDebug("RIP Linear: %x\n", linear_addr); + + guest_pa_to_host_pa(info, linear_addr, &host_addr); + + PrintDebug("Host Address of rip = 0x%x\n", host_addr); + + PrintDebug("Instr (15 bytes) at %x:\n", host_addr); + PrintTraceMemDump((char*)host_addr, 15); + break; } } @@ -252,10 +279,10 @@ void Init_VMCB(vmcb_t * vmcb, struct guest_info vm_info) { if (vm_info.page_mode == SHADOW_PAGING) { PrintDebug("Creating initial shadow page table\n"); - vm_info.shdw_pg_state.shadow_cr3.e_reg.low |= ((addr_t)create_passthrough_pde32_pts(&vm_info) & ~0xfff); + vm_info.shdw_pg_state.shadow_cr3 |= ((addr_t)create_passthrough_pde32_pts(&vm_info) & ~0xfff); PrintDebug("Created\n"); - guest_state->cr3 = vm_info.shdw_pg_state.shadow_cr3.r_reg; + guest_state->cr3 = vm_info.shdw_pg_state.shadow_cr3; ctrl_area->cr_reads.cr3 = 1; ctrl_area->cr_writes.cr3 = 1; @@ -398,10 +425,10 @@ void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info vm_info) { if (vm_info.page_mode == SHADOW_PAGING) { PrintDebug("Creating initial shadow page table\n"); - vm_info.shdw_pg_state.shadow_cr3.e_reg.low |= ((addr_t)create_passthrough_pde32_pts(&vm_info) & ~0xfff); + vm_info.shdw_pg_state.shadow_cr3 |= ((addr_t)create_passthrough_pde32_pts(&vm_info) & ~0xfff); PrintDebug("Created\n"); - guest_state->cr3 = vm_info.shdw_pg_state.shadow_cr3.r_reg; + guest_state->cr3 = vm_info.shdw_pg_state.shadow_cr3; //PrintDebugPageTables((pde32_t*)(vm_info.shdw_pg_state.shadow_cr3.e_reg.low));