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.


major VMX update
[palacios.git] / palacios / src / palacios / svm.c
index ba7f5b3..7dcd68d 100644 (file)
@@ -39,7 +39,6 @@
 #include <palacios/vmm_direct_paging.h>
 
 #include <palacios/vmm_ctrl_regs.h>
-#include <palacios/vmm_config.h>
 #include <palacios/svm_io.h>
 
 #include <palacios/vmm_sprintf.h>
@@ -267,25 +266,25 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info * vm_info) {
 }
 
 
-static int init_svm_guest(struct guest_info * info, struct v3_vm_config * config_ptr) {
-
-
-    v3_pre_config_guest(info, config_ptr);
+int v3_init_svm_vmcb(struct guest_info * info, v3_vm_class_t vm_class) {
 
     PrintDebug("Allocating VMCB\n");
     info->vmm_data = (void*)Allocate_VMCB();
-
-    PrintDebug("Initializing VMCB (addr=%p)\n", (void *)info->vmm_data);
-    Init_VMCB_BIOS((vmcb_t*)(info->vmm_data), info);
-
-    v3_post_config_guest(info, config_ptr);
+    
+    if (vm_class == V3_PC_VM) {
+       PrintDebug("Initializing VMCB (addr=%p)\n", (void *)info->vmm_data);
+       Init_VMCB_BIOS((vmcb_t*)(info->vmm_data), info);
+    } else {
+       PrintError("Invalid VM class\n");
+       return -1;
+    }
 
     return 0;
 }
 
 
 
-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)) {
@@ -318,7 +317,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)) {
@@ -436,6 +435,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
+
+
     /* ** */
 
     /*
@@ -498,10 +507,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
 
 
@@ -518,19 +527,12 @@ 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;
 }
 
 
-static int start_svm_guest(struct guest_info *info) {
+int v3_start_svm_guest(struct guest_info *info) {
     //    vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data));
     //  vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data));
 
@@ -690,15 +692,6 @@ void v3_init_svm_cpu(int cpu_id) {
 }
 
 
-void v3_init_svm_hooks(struct v3_ctrl_ops * vmm_ops) {
-
-    // Setup the SVM specific vmm operations
-    vmm_ops->init_guest = &init_svm_guest;
-    vmm_ops->start_guest = &start_svm_guest;
-    vmm_ops->has_nested_paging = &has_svm_nested_paging;
-
-    return;
-}