X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm.c;h=c56356d540dfe1579eecd51a38332f429ffd30b3;hb=888c2dd8a3914f9a08e2b0e006ff96c5cc5cd792;hp=90118eb297709e14b21c979ab6a184ff0257cb2f;hpb=5bf6d0c260240e314876a2fca8e3fd56bd6a1029;p=palacios.git diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 90118eb..c56356d 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef CONFIG_SVM #include @@ -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,11 +71,11 @@ static void init_cpu(void * arg) { - - 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; @@ -101,6 +100,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 +122,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 +147,6 @@ int v3_start_vm(struct guest_info * info, unsigned int cpu_mask) { return -1; } - return 0; } @@ -190,6 +190,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 +206,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 +222,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 +262,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 +270,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 +281,3 @@ int v3_vm_enter(struct guest_info * info) { return -1; } } - - -