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.


debugging tweaks and minor fixes
[palacios.git] / palacios / src / palacios / vmm.c
index 90118eb..7077d66 100644 (file)
@@ -24,6 +24,7 @@
 #include <palacios/vmm_instrument.h>
 #include <palacios/vmm_ctrl_regs.h>
 #include <palacios/vmm_lowlevel.h>
+#include <palacios/vmm_sprintf.h>
 
 #ifdef CONFIG_SVM
 #include <palacios/svm.h>
@@ -36,9 +37,7 @@
 v3_cpu_arch_t v3_cpu_types[CONFIG_MAX_CPUS];
 struct v3_os_hooks * os_hooks = NULL;
 
-
-
-
+int v3_dbg_enable = 0;
 
 
 static struct guest_info * allocate_guest() {
@@ -72,8 +71,6 @@ static void init_cpu(void * arg) {
 
 
 
-
-
 void Init_V3(struct v3_os_hooks * hooks, int num_cpus) {
     int i;
 
@@ -101,6 +98,7 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) {
     }
 }
 
+
 v3_cpu_arch_t v3_get_cpu_type(int cpu_id) {
     return v3_cpu_types[cpu_id];
 }
@@ -122,6 +120,7 @@ struct guest_info * v3_create_vm(void * cfg) {
     return info;
 }
 
+
 int v3_start_vm(struct guest_info * info, unsigned int cpu_mask) {
     
     info->cpu_id = v3_get_cpu_id();
@@ -146,7 +145,6 @@ int v3_start_vm(struct guest_info * info, unsigned int cpu_mask) {
            return -1;
     }
 
-
     return 0;
 }
 
@@ -190,6 +188,7 @@ v3_cpu_mode_t v3_get_host_cpu_mode() {
     } while (0)                                                \
 
 
+
 void v3_yield_cond(struct guest_info * info) {
     uint64_t cur_cycle;
     rdtscll(cur_cycle);
@@ -205,6 +204,7 @@ void v3_yield_cond(struct guest_info * info) {
     }
 }
 
+
 /* 
  * unconditional cpu yield 
  * if the yielding thread is a guest context, the guest quantum is reset on resumption 
@@ -220,6 +220,23 @@ void v3_yield(struct guest_info * info) {
 
 
 
+
+void v3_print_cond(const char * fmt, ...) {
+    if (v3_dbg_enable == 1) {
+       char buf[2048];
+       va_list ap;
+
+       va_start(ap, fmt);
+       vsnprintf(buf, 2048, fmt, ap);
+       va_end(ap);
+
+       V3_Print("%s", buf);
+    }    
+}
+
+
+
+
 void v3_interrupt_cpu(struct guest_info * info, int logical_cpu) {
     extern struct v3_os_hooks * os_hooks;
 
@@ -243,8 +260,6 @@ unsigned int v3_get_cpu_id() {
 
 
 
-
-
 int v3_vm_enter(struct guest_info * info) {
     switch (v3_cpu_types[info->cpu_id]) {
 #ifdef CONFIG_SVM
@@ -253,7 +268,7 @@ int v3_vm_enter(struct guest_info * info) {
            return v3_svm_enter(info);
            break;
 #endif
-#if CONFIG_VMX && 0
+#if CONFIG_VMX
        case V3_VMX_CPU:
        case V3_VMX_EPT_CPU:
            return v3_vmx_enter(info);
@@ -264,6 +279,3 @@ int v3_vm_enter(struct guest_info * info) {
            return -1;
     }
 }
-
-
-