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.


new copy of manual
[palacios.git] / palacios / src / palacios / svm.c
index 09fe744..9f72514 100644 (file)
@@ -44,6 +44,8 @@
 #include <palacios/vmm_sprintf.h>
 
 
+uint32_t v3_last_exit;
+
 // This is a global pointer to the host's VMCB
 static addr_t host_vmcbs[CONFIG_MAX_CPUS] = { [0 ... CONFIG_MAX_CPUS - 1] = 0};
 
@@ -284,7 +286,7 @@ int v3_init_svm_vmcb(struct guest_info * info, v3_vm_class_t vm_class) {
 
 
 
-static int update_irq_state_atomic(struct guest_info * info) {
+static int update_irq_exit_state(struct guest_info * info) {
     vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data));
 
     if ((info->intr_state.irq_pending == 1) && (guest_ctrl->guest_ctrl.V_IRQ == 0)) {
@@ -317,7 +319,7 @@ static int update_irq_state_atomic(struct guest_info * info) {
 }
 
 
-static int update_irq_state(struct guest_info * info) {
+static int update_irq_entry_state(struct guest_info * info) {
     vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data));
 
     if (v3_excp_pending(info)) {
@@ -417,6 +419,8 @@ int v3_svm_enter(struct guest_info * info) {
     // disable global interrupts for vm state transition
     v3_clgi();
 
+    /// checkpoint 
+
     // Synchronize the guest state to the VMCB
     guest_state->cr0 = info->ctrl_regs.cr0;
     guest_state->cr2 = info->ctrl_regs.cr2;
@@ -435,6 +439,16 @@ int v3_svm_enter(struct guest_info * info) {
     guest_state->rax = info->vm_regs.rax;
     guest_state->rip = info->rip;
     guest_state->rsp = info->vm_regs.rsp;
+
+#ifdef CONFIG_SYMBIOTIC
+    if (info->sym_state.sym_call_active == 0) {
+       update_irq_entry_state(info);
+    }
+#else 
+    update_irq_entry_state(info);
+#endif
+
+
     /* ** */
 
     /*
@@ -453,10 +467,15 @@ int v3_svm_enter(struct guest_info * info) {
 
 
     rdtscll(info->time_state.cached_host_tsc);
-    //    guest_ctrl->TSC_OFFSET = info->time_state.guest_tsc - info->time_state.cached_host_tsc;
+    guest_ctrl->TSC_OFFSET = info->time_state.guest_tsc - info->time_state.cached_host_tsc;
        
     v3_svm_launch((vmcb_t *)V3_PAddr(info->vmm_data), &(info->vm_regs), (vmcb_t *)host_vmcbs[info->cpu_id]);
     
+
+    v3_last_exit = (uint32_t)(guest_ctrl->exit_code);
+
+    //  v3_print_cond("SVM Returned: Exit Code: %x\n", (uint32_t)(guest_ctrl->exit_code));
+
     rdtscll(tmp_tsc);
 
     //PrintDebug("SVM Returned\n");
@@ -497,10 +516,10 @@ int v3_svm_enter(struct guest_info * info) {
 
 #ifdef CONFIG_SYMBIOTIC
     if (info->sym_state.sym_call_active == 0) {
-       update_irq_state_atomic(info);
+       update_irq_exit_state(info);
     }
 #else
-    update_irq_state_atomic(info);
+    update_irq_exit_state(info);
 #endif
 
 
@@ -517,13 +536,6 @@ int v3_svm_enter(struct guest_info * info) {
        return -1;
     }
 
-#ifdef CONFIG_SYMBIOTIC
-    if (info->sym_state.sym_call_active == 0) {
-       update_irq_state(info);
-    }
-#else 
-    update_irq_state(info);
-#endif
 
     return 0;
 }
@@ -580,13 +592,12 @@ int v3_start_svm_guest(struct guest_info *info) {
            break;
        }
        
+/*
        if ((info->num_exits % 5000) == 0) {
            V3_Print("SVM Exit number %d\n", (uint32_t)info->num_exits);
        }
-
-
+*/
        
-
     }
     return 0;
 }