X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_exits.c;h=97504bccaeebe0ccbda29ecad4808b06464d21bf;hb=a7bd09077efcd826376f9c49ab97f9f9a1fbbefe;hp=e76a3b353ef2adcedec5c53887407cb81c5516dc;hpb=45990b15161a5d97d4e4b7c4caeb84afb933de98;p=palacios.releases.git diff --git a/palacios/src/palacios/vmm_exits.c b/palacios/src/palacios/vmm_exits.c index e76a3b3..97504bc 100644 --- a/palacios/src/palacios/vmm_exits.c +++ b/palacios/src/palacios/vmm_exits.c @@ -173,8 +173,55 @@ int v3_hook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, v3_lower_barrier(vm); } + return 0; +} - return 0; +int v3_unhook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, struct guest_info * current_core) { + struct v3_exit_map * map = &(vm->exit_map); + struct v3_exit_hook * hook = NULL; + + + if (exit_type >= V3_EXIT_INVALID) { + PrintError("Error: Tried to unhook invalid exit type (%d)\n", exit_type); + return -1; + } + + hook = &(map->exits[exit_type]); + + if (hook->registered == 0) { + PrintError("Tried to unhook an unregistered exit (%d)\n", exit_type); + return -1; + } + + if (hook->hooked == 0) { + PrintError("Tried to unhook and unhooked exit (%d)\n", exit_type); + return -1; + } + + + hook->hooked = 0; + hook->handler = NULL; + hook->priv_data = NULL; + + + if (vm->run_state != VM_INVALID) { + int i = 0; + + while (v3_raise_barrier(vm, current_core) == -1); + + for (i = 0; i < vm->num_cores; i++) { + + if (hook->disable(&(vm->cores[i]), exit_type) != 0) { + PrintError("Error could not enable exit hook %d on core %d\n", exit_type, i); + v3_lower_barrier(vm); + return -1; + } + } + + v3_lower_barrier(vm); + } + + return 0; }