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.


Minor debugging print changes/fixups
[palacios.git] / palacios / src / palacios / vm_guest.c
index fe22f0b..cca2359 100644 (file)
@@ -364,9 +364,10 @@ void v3_print_GPRs(struct guest_info * info) {
 #include <palacios/vmcs.h>
 #include <palacios/vmcb.h>
 static int info_hcall(struct guest_info * core, uint_t hcall_id, void * priv_data) {
-    v3_cpu_arch_t cpu_type = v3_get_cpu_type(v3_get_cpu_id());
+    v3_cpu_arch_t cpu_type = v3_get_cpu_type(V3_Get_CPU());
     int cpu_valid = 0;
 
+    V3_Print("************** Guest State ************\n");
     v3_print_guest_state(core);
     
     // init SVM/VMX
@@ -406,7 +407,7 @@ static int info_hcall(struct guest_info * core, uint_t hcall_id, void * priv_dat
 
 
 int v3_init_vm(struct v3_vm_info * vm) {
-    v3_cpu_arch_t cpu_type = v3_get_cpu_type(v3_get_cpu_id());
+    v3_cpu_arch_t cpu_type = v3_get_cpu_type(V3_Get_CPU());
     int cpu_valid = 0;
 
     if (v3_get_foreground_vm() == NULL) {
@@ -474,8 +475,7 @@ int v3_init_vm(struct v3_vm_info * vm) {
 }
 
 int v3_init_core(struct guest_info * core) {
-    v3_cpu_arch_t cpu_type = v3_get_cpu_type(v3_get_cpu_id());
-    int cpu_valid = 0;
+    v3_cpu_arch_t cpu_type = v3_get_cpu_type(V3_Get_CPU());
     struct v3_vm_info * vm = core->vm_info;
 
     /*
@@ -501,27 +501,30 @@ int v3_init_core(struct guest_info * core) {
 #endif
 
     // init SVM/VMX
+
+
+    switch (cpu_type) {
 #ifdef CONFIG_SVM
-    if ((cpu_type == V3_SVM_CPU) || (cpu_type == V3_SVM_REV3_CPU)) {
-       if (v3_init_svm_vmcb(core, vm->vm_class) == -1) {
-           PrintError("Error in SVM initialization\n");
-           return -1;
-       }
-       cpu_valid = 1;
-    }
+       case V3_SVM_CPU:
+       case V3_SVM_REV3_CPU:
+           if (v3_init_svm_vmcb(core, vm->vm_class) == -1) {
+               PrintError("Error in SVM initialization\n");
+               return -1;
+           }
+           break;
 #endif
 #ifdef CONFIG_VMX
-    if ((cpu_type == V3_VMX_CPU) || (cpu_type == V3_VMX_EPT_CPU)) {
-       if (v3_init_vmx_vmcs(core, vm->vm_class) == -1) {
-           PrintError("Error in VMX initialization\n");
-           return -1;
-       }
-       cpu_valid = 1;
-    }
+       case V3_VMX_CPU:
+       case V3_VMX_EPT_CPU:
+           if (v3_init_vmx_vmcs(core, vm->vm_class) == -1) {
+               PrintError("Error in VMX initialization\n");
+               return -1;
+           }
+           break;
 #endif
-    if (!cpu_valid) {
-       PrintError("Invalid CPU Type 0x%x\n", cpu_type);
-       return -1;
+       default:
+           PrintError("Invalid CPU Type 0x%x\n", cpu_type);
+           return -1;
     }
 
     return 0;