X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx.c;h=f0823b4cfe5c6d099fd8950fe8351985aefc4487;hb=60ad6a41c6d0ee08ed689e8505eb0c3df0c2a289;hp=de81dfc9df654f5b3e731765819ffbc2e4ba0161;hpb=9feccf93cd8327d1d30a404a92f19716bf5a1e96;p=palacios.git diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index de81dfc..f0823b4 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -44,6 +44,10 @@ #include #include +#ifdef V3_CONFIG_MEM_TRACK +#include +#endif + #ifndef V3_CONFIG_DEBUG_VMX #undef PrintDebug #define PrintDebug(fmt, args...) @@ -270,16 +274,19 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state) // Cause VM_EXIT whenever CR4.VMXE or CR4.PAE bits are written - vmx_ret |= check_vmcs_write(VMCS_CR4_MASK, CR4_VMXE | CR4_PAE); + vmx_ret |= check_vmcs_write(VMCS_CR4_MASK, CR4_VMXE | CR4_PAE ); - core->ctrl_regs.cr3 = core->direct_map_pt; + v3_activate_passthrough_pt(core); // vmx_state->pinbased_ctrls |= NMI_EXIT; /* Add CR exits */ vmx_state->pri_proc_ctrls.cr3_ld_exit = 1; vmx_state->pri_proc_ctrls.cr3_str_exit = 1; - + + // Note that we intercept cr4.pae writes + // and we have cr4 read-shadowed to the shadow pager's cr4 + vmx_state->pri_proc_ctrls.invlpg_exit = 1; /* Add page fault exits */ @@ -326,7 +333,7 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state) - if (v3_init_ept(core, &hw_info) == -1) { + if (v3_init_nested_paging_core(core, &hw_info) == -1) { PrintError(core->vm_info, core, "Error initializing EPT\n"); return -1; } @@ -424,7 +431,7 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state) ((struct cr0_32 *)&(core->shdw_pg_state.guest_cr0))->ne = 1; ((struct cr0_32 *)&(core->shdw_pg_state.guest_cr0))->cd = 0; - if (v3_init_ept(core, &hw_info) == -1) { + if (v3_init_nested_paging_core(core, &hw_info) == -1) { PrintError(core->vm_info, core, "Error initializing EPT\n"); return -1; } @@ -975,6 +982,10 @@ int v3_vmx_enter(struct guest_info * info) { // Conditionally yield the CPU if the timeslice has expired v3_schedule(info); +#ifdef V3_CONFIG_MEM_TRACK + v3_mem_track_entry(info); +#endif + // Update timer devices late after being in the VM so that as much // of the time in the VM is accounted for as possible. Also do it before // updating IRQ entry state so that any interrupts the timers raise get @@ -1175,6 +1186,10 @@ int v3_vmx_enter(struct guest_info * info) { v3_handle_timeouts(info, guest_cycles); } +#ifdef V3_CONFIG_MEM_TRACK + v3_mem_track_exit(info); +#endif + return 0; } @@ -1183,6 +1198,13 @@ int v3_start_vmx_guest(struct guest_info * info) { PrintDebug(info->vm_info, info, "Starting VMX core %u\n", info->vcpu_id); +#if V3_CONFIG_HVM + if (v3_setup_hvm_vm_for_boot(vm)) { + PrintError(vm, VCORE_NONE, "HVM setup for boot failed\n"); + return -1; + } +#endif + while (1) { if (info->core_run_state == CORE_STOPPED) { if (info->vcpu_id == 0) {