X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_exits.c;h=c4b26d6a0dd29e86215df4dfd1f3a0a461087933;hb=a47bf8387bc195230e95edb4b0c9ffb81e50ac9f;hp=8093faef81db3cbfea31b8e1f1f26a1b1de7bd6b;hpb=2f4952e76f4fadb1abd32626b57b6d9b272003cc;p=palacios.git diff --git a/palacios/src/palacios/vmm_exits.c b/palacios/src/palacios/vmm_exits.c index 8093fae..c4b26d6 100644 --- a/palacios/src/palacios/vmm_exits.c +++ b/palacios/src/palacios/vmm_exits.c @@ -29,7 +29,7 @@ int v3_init_exit_hooks(struct v3_vm_info * vm) { map->exits = V3_Malloc(sizeof(struct v3_exit_hook) * V3_EXIT_INVALID); if (map->exits == NULL) { - PrintError("Error allocating exit map\n"); + PrintError(vm, VCORE_NONE, "Error allocating exit map\n"); return -1; } @@ -61,7 +61,7 @@ int v3_init_exit_hooks_core(struct guest_info * core) { if (hook->hooked) { if (hook->enable(core, i) != 0) { - PrintError("Error could not enable exit hook %d on core %d\n", i, core->vcpu_id); + PrintError(core->vm_info, core, "Error could not enable exit hook %d on core %d\n", i, core->vcpu_id); return -1; } } @@ -82,14 +82,14 @@ int v3_dispatch_exit_hook(struct guest_info * core, v3_exit_type_t exit_type, vo struct v3_exit_hook * hook = NULL; if (exit_type >= V3_EXIT_INVALID) { - PrintError("Error: Tried to dispatch invalid exit type (%d)\n", exit_type); + PrintError(core->vm_info, core, "Error: Tried to dispatch invalid exit type (%d)\n", exit_type); return -1; } hook = &(map->exits[exit_type]); if (hook->hooked == 0) { - PrintError("Tried to dispatch an unhooked exit (%d)\n", exit_type); + PrintError(core->vm_info, core, "Tried to dispatch an unhooked exit (%d)\n", exit_type); return -1; } @@ -105,14 +105,14 @@ int v3_register_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, struct v3_exit_hook * hook = NULL; if (exit_type >= V3_EXIT_INVALID) { - PrintError("Error: Tried to register invalid exit type (%d)\n", exit_type); + PrintError(vm, VCORE_NONE, "Error: Tried to register invalid exit type (%d)\n", exit_type); return -1; } hook = &(map->exits[exit_type]); if (hook->registered == 1) { - PrintError("Tried to reregister an exit (%d)\n", exit_type); + PrintError(vm, VCORE_NONE, "Tried to reregister an exit (%d)\n", exit_type); return -1; } @@ -135,19 +135,19 @@ int v3_hook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, if (exit_type >= V3_EXIT_INVALID) { - PrintError("Error: Tried to hook invalid exit type (%d)\n", exit_type); + PrintError(vm, VCORE_NONE, "Error: Tried to hook invalid exit type (%d)\n", exit_type); return -1; } hook = &(map->exits[exit_type]); if (hook->registered == 0) { - PrintError("Tried to hook unregistered exit (%d)\n", exit_type); + PrintError(vm, VCORE_NONE, "Tried to hook unregistered exit (%d)\n", exit_type); return -1; } if (hook->hooked != 0) { - PrintError("Tried to rehook exit (%d)\n", exit_type); + PrintError(vm, VCORE_NONE, "Tried to rehook exit (%d)\n", exit_type); return -1; } @@ -156,8 +156,7 @@ int v3_hook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, hook->handler = handler; hook->priv_data = priv_data; - if ((vm->run_state == VM_RUNNING) || - (vm->run_state == VM_SIMULATING)) { + if (vm->run_state != VM_INVALID) { int i = 0; while (v3_raise_barrier(vm, current_core) == -1); @@ -165,7 +164,7 @@ int v3_hook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, for (i = 0; i < vm->num_cores; i++) { if (hook->enable(&(vm->cores[i]), exit_type) != 0) { - PrintError("Error could not enable exit hook %d on core %d\n", exit_type, i); + PrintError(vm, VCORE_NONE, "Error could not enable exit hook %d on core %d\n", exit_type, i); v3_lower_barrier(vm); return -1; } @@ -185,19 +184,19 @@ int v3_unhook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, struct gues if (exit_type >= V3_EXIT_INVALID) { - PrintError("Error: Tried to unhook invalid exit type (%d)\n", exit_type); + PrintError(vm, VCORE_NONE, "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); + PrintError(vm, VCORE_NONE, "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); + PrintError(vm, VCORE_NONE, "Tried to unhook and unhooked exit (%d)\n", exit_type); return -1; } @@ -207,8 +206,7 @@ int v3_unhook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, struct gues hook->priv_data = NULL; - if ((vm->run_state == VM_RUNNING) || - (vm->run_state == VM_SIMULATING)) { + if (vm->run_state != VM_INVALID) { int i = 0; while (v3_raise_barrier(vm, current_core) == -1); @@ -216,7 +214,7 @@ int v3_unhook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, struct gues 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); + PrintError(vm, VCORE_NONE, "Error could not enable exit hook %d on core %d\n", exit_type, i); v3_lower_barrier(vm); return -1; }