#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>
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() {
-
-
void Init_V3(struct v3_os_hooks * hooks, int num_cpus) {
int i;
+ V3_Print("V3 Print statement to fix a Kitten page fault bug\n");
+
// Set global variables.
os_hooks = hooks;
}
}
+
v3_cpu_arch_t v3_get_cpu_type(int cpu_id) {
return v3_cpu_types[cpu_id];
}
return info;
}
+
int v3_start_vm(struct guest_info * info, unsigned int cpu_mask) {
info->cpu_id = v3_get_cpu_id();
return v3_start_svm_guest(info);
break;
#endif
-#if CONFIG_VMX && 0
+#if CONFIG_VMX
case V3_VMX_CPU:
case V3_VMX_EPT_CPU:
return v3_start_vmx_guest(info);
return -1;
}
-
return 0;
}
} while (0) \
+
void v3_yield_cond(struct guest_info * info) {
uint64_t cur_cycle;
rdtscll(cur_cycle);
}
}
+
/*
* unconditional cpu yield
* if the yielding thread is a guest context, the guest quantum is reset on resumption
+
+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;
-
-
int v3_vm_enter(struct guest_info * info) {
switch (v3_cpu_types[info->cpu_id]) {
#ifdef CONFIG_SVM
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);
return -1;
}
}
-
-
-