X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm.c;h=402cedf5efbb3e4bbd77d5ff3b817e5e70a456ca;hp=0a53a7f5bb435bea5599a37cdb80f3ff0ef016bd;hb=68521eca0f94f8c22aa60e762c83e24beec7233c;hpb=123a1ba27ea09c8fa77a1b36ce625b43d7c48b14 diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 0a53a7f..402cedf 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #ifdef CONFIG_SVM #include @@ -36,9 +38,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 +72,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; @@ -99,8 +99,13 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) { hooks->call_on_cpu(i, &init_cpu, (void *)(addr_t)i); } } + +#ifdef CONFIG_VNET + v3_init_vnet(); +#endif } + v3_cpu_arch_t v3_get_cpu_type(int cpu_id) { return v3_cpu_types[cpu_id]; } @@ -122,6 +127,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(); @@ -135,7 +141,7 @@ int v3_start_vm(struct guest_info * info, unsigned int cpu_mask) { 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); @@ -146,7 +152,6 @@ int v3_start_vm(struct guest_info * info, unsigned int cpu_mask) { return -1; } - return 0; } @@ -190,6 +195,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 +211,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 +227,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 +267,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 +275,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 +286,3 @@ int v3_vm_enter(struct guest_info * info) { return -1; } } - - -