Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


HVM capability enhancement: asynchronous upcalls to ROS userspace
[palacios.git] / palacios / src / palacios / vmx.c
index 23d631a..f45ffa3 100644 (file)
@@ -546,7 +546,10 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state)
     vmx_ret |= check_vmcs_write(VMCS_LINK_PTR_HIGH, (addr_t)0xffffffffUL);
 #endif
 
-
+    if (vmx_ret != VMX_SUCCESS) { 
+       PrintError(core->vm_info, core, "Error configuring VMX\n");
+       return -1;
+    }
 
  
 
@@ -621,6 +624,11 @@ static void __init_vmx_vmcs(void * arg) {
     PrintDebug(core->vm_info, core, "Serializing VMCS: %p\n", (void *)vmx_state->vmcs_ptr_phys);
     vmx_ret = vmcs_clear(vmx_state->vmcs_ptr_phys);
 
+    if (vmx_ret != VMX_SUCCESS) { 
+       PrintError(core->vm_info,core,"VMCS Clear failed\n");
+       return;
+    }
+
     core->core_run_state = CORE_STOPPED;
     return;
 }
@@ -986,6 +994,10 @@ int v3_vmx_enter(struct guest_info * info) {
     v3_mem_track_entry(info);
 #endif 
 
+#ifdef V3_CONFIG_HVM
+    v3_handle_hvm_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 
@@ -1130,6 +1142,8 @@ int v3_vmx_enter(struct guest_info * info) {
 
     if (info->shdw_pg_mode == NESTED_PAGING) {
        check_vmcs_read(VMCS_GUEST_PHYS_ADDR, &(exit_info.ept_fault_addr));
+    } else {
+       exit_info.ept_fault_addr = 0;
     }
 
     //PrintDebug(info->vm_info, info, "VMX Exit taken, id-qual: %u-%lu\n", exit_info.exit_reason, exit_info.exit_qual);
@@ -1186,6 +1200,10 @@ int v3_vmx_enter(struct guest_info * info) {
        v3_handle_timeouts(info, guest_cycles);
     }
 
+#ifdef V3_CONFIG_HVM
+    v3_handle_hvm_exit(info);
+#endif
+
 #ifdef V3_CONFIG_MEM_TRACK
     v3_mem_track_exit(info);
 #endif 
@@ -1259,6 +1277,18 @@ int v3_start_vmx_guest(struct guest_info * info) {
        }
        
        
+#ifdef V3_CONFIG_HVM
+        if (v3_handle_hvm_reset(info) > 0) {
+           continue;
+        }
+#endif
+       
+#ifdef V3_CONFIG_MULTIBOOT
+        if (v3_handle_multiboot_reset(info) > 0) {
+           continue;
+        }
+#endif
+
 #ifdef V3_CONFIG_PMU_TELEMETRY
        v3_pmu_telemetry_start(info);
 #endif
@@ -1284,9 +1314,15 @@ int v3_start_vmx_guest(struct guest_info * info) {
             linear_addr = get_addr_linear(info, info->rip, &(info->segments.cs));
             
             if (info->mem_mode == PHYSICAL_MEM) {
-                v3_gpa_to_hva(info, linear_addr, &host_addr);
+                if (v3_gpa_to_hva(info, linear_addr, &host_addr)) {
+                   PrintError(info->vm_info, info, "Cannot translate address\n");
+                   return -1;
+               }
             } else if (info->mem_mode == VIRTUAL_MEM) {
-                v3_gva_to_hva(info, linear_addr, &host_addr);
+                if (v3_gva_to_hva(info, linear_addr, &host_addr)) {
+                   PrintError(info->vm_info, info, "Cannot translate address\n");
+                   return -1;
+               }
             }
             
             V3_Print(info->vm_info, info, "VMX core %u: Host Address of rip = 0x%p\n", info->vcpu_id, (void *)host_addr);