X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm.c;h=653643f42c6da182ce0bb36c64761d10cbfcdf87;hb=99681a48f662b5a8371f20b255b3789012d2a9fa;hp=b052eeeca556df241bdc3e8c0f3194e06a0e50b4;hpb=a6865d183eedbdf3e5510e4be89dcb5ce51b5953;p=palacios.git diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index b052eee..653643f 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -39,6 +39,8 @@ #include +#include + extern void v3_stgi(); extern void v3_clgi(); @@ -196,7 +198,8 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info *vm_info) { struct v3_io_hook * iter; struct rb_node * io_node = v3_rb_first(&(vm_info->io_map)); addr_t io_port_bitmap; - + int i = 0; + io_port_bitmap = (addr_t)V3_VAddr(V3_AllocPages(3)); memset((uchar_t*)io_port_bitmap, 0, PAGE_SIZE * 3); @@ -209,10 +212,13 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info *vm_info) { ushort_t port = iter->port; uchar_t * bitmap = (uchar_t *)io_port_bitmap; + PrintDebug("%d: Hooking Port %d\n", i, port); bitmap += (port / 8); // PrintDebug("Setting Bit for port 0x%x\n", port); *bitmap |= 1 << (port % 8); + + i++; } while ((io_node = v3_rb_next(io_node))); @@ -348,12 +354,15 @@ static int start_svm_guest(struct guest_info *info) { ullong_t tmp_tsc; uint_t vm_cr_low = 0, vm_cr_high = 0; - v3_enable_ints(); v3_clgi(); - //PrintDebug("SVM Entry to rip=%p...\n", (void *)info->rip); + /* + PrintDebug("SVM Entry to CS=%p rip=%p...\n", + (void *)(addr_t)info->segments.cs.base, + (void *)(addr_t)info->rip); + */ v3_get_msr(0xc0000101, &vm_cr_high, &vm_cr_low); @@ -376,10 +385,13 @@ static int start_svm_guest(struct guest_info *info) { v3_stgi(); - if (num_exits % 25 == 0) { + if ((num_exits % 5000) == 0) { PrintDebug("SVM Exit number %d\n", num_exits); + if (info->enable_profiler) + v3_print_profile(info); } + if (v3_handle_svm_exit(info) != 0) { vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data)); @@ -408,10 +420,6 @@ static int start_svm_guest(struct guest_info *info) { } v3_print_GPRs(info); - - - - PrintDebug("SVM Exit Code: %p\n", (void *)(addr_t)guest_ctrl->exit_code); PrintDebug("exit_info1 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info1)); @@ -434,6 +442,7 @@ static int start_svm_guest(struct guest_info *info) { break; } + } return 0; }