X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm.c;h=09fe744ec0abd05e1c67d607ad0846c8f823b1e1;hp=a72f5967ed5d1d14653da4920bf7aba3287d7af9;hb=123a1ba27ea09c8fa77a1b36ce625b43d7c48b14;hpb=28cfe68985ef4360c9bd7428a19c222b295e9d85 diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index a72f596..09fe744 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -39,7 +39,6 @@ #include #include -#include #include #include @@ -267,18 +266,18 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info * vm_info) { } -static int init_svm_guest(struct guest_info * info, struct v3_vm_config * config_ptr) { - - - v3_pre_config_guest(info, config_ptr); +int v3_init_svm_vmcb(struct guest_info * info, v3_vm_class_t vm_class) { PrintDebug("Allocating VMCB\n"); info->vmm_data = (void*)Allocate_VMCB(); - - PrintDebug("Initializing VMCB (addr=%p)\n", (void *)info->vmm_data); - Init_VMCB_BIOS((vmcb_t*)(info->vmm_data), info); - - v3_post_config_guest(info, config_ptr); + + if (vm_class == V3_PC_VM) { + PrintDebug("Initializing VMCB (addr=%p)\n", (void *)info->vmm_data); + Init_VMCB_BIOS((vmcb_t*)(info->vmm_data), info); + } else { + PrintError("Invalid VM class\n"); + return -1; + } return 0; } @@ -338,8 +337,6 @@ static int update_irq_state(struct guest_info * info) { guest_ctrl->EVENTINJ.valid = 1; - - #ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("<%d> Injecting Exception %d (CR2=%p) (EIP=%p)\n", (int)info->num_exits, @@ -349,8 +346,6 @@ static int update_irq_state(struct guest_info * info) { #endif v3_injecting_excp(info, excp); - - } else if (info->intr_state.irq_started == 1) { #ifdef CONFIG_DEBUG_INTERRUPTS PrintDebug("IRQ pending from previous injection\n"); @@ -470,13 +465,6 @@ int v3_svm_enter(struct guest_info * info) { v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); -#ifdef CONFIG_SYMBIOTIC - if (info->sym_state.sym_call_active == 0) { - update_irq_state_atomic(info); - } -#else - update_irq_state_atomic(info); -#endif // Save Guest state from VMCB info->rip = guest_state->rip; @@ -507,6 +495,15 @@ int v3_svm_enter(struct guest_info * info) { exit_info2 = guest_ctrl->exit_info2; +#ifdef CONFIG_SYMBIOTIC + if (info->sym_state.sym_call_active == 0) { + update_irq_state_atomic(info); + } +#else + update_irq_state_atomic(info); +#endif + + // reenable global interrupts after vm exit v3_stgi(); @@ -532,7 +529,7 @@ int v3_svm_enter(struct guest_info * info) { } -static int start_svm_guest(struct guest_info *info) { +int v3_start_svm_guest(struct guest_info *info) { // vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); // vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data)); @@ -692,15 +689,6 @@ void v3_init_svm_cpu(int cpu_id) { } -void v3_init_svm_hooks(struct v3_ctrl_ops * vmm_ops) { - - // Setup the SVM specific vmm operations - vmm_ops->init_guest = &init_svm_guest; - vmm_ops->start_guest = &start_svm_guest; - vmm_ops->has_nested_paging = &has_svm_nested_paging; - - return; -}