X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_hypercall.c;h=21e6e96d66bb83b43455b204baf434261a0db771;hb=4d1d8fadad33de7d3ebce2083d9782048f78b44e;hp=b6148964e097a0618d44a2bc6035843a04aedd80;hpb=b3662a67b9b28e2b0724ebb2ea10edccba5d2a5b;p=palacios.git diff --git a/palacios/src/palacios/vmm_hypercall.c b/palacios/src/palacios/vmm_hypercall.c index b614896..21e6e96 100644 --- a/palacios/src/palacios/vmm_hypercall.c +++ b/palacios/src/palacios/vmm_hypercall.c @@ -136,6 +136,11 @@ int v3_register_hypercall(struct v3_vm_info * vm, hcall_id_t hypercall_id, struct hypercall * hcall = (struct hypercall *)V3_Malloc(sizeof(struct hypercall)); + if (!hcall) { + PrintError(vm, VCORE_NONE, "Cannot allocate in registering hypercall\n"); + return -1; + } + hcall->id = hypercall_id; hcall->priv_data = priv_data; hcall->hcall_fn = hypercall; @@ -161,7 +166,7 @@ int v3_remove_hypercall(struct v3_vm_info * vm, hcall_id_t hypercall_id) { struct hypercall * hcall = get_hypercall(vm, hypercall_id); if (hcall == NULL) { - PrintError("Attempted to remove non existant hypercall\n"); + PrintError(vm, VCORE_NONE, "Attempted to remove non existant hypercall\n"); return -1; } @@ -176,15 +181,15 @@ int v3_handle_hypercall(struct guest_info * info) { struct hypercall * hcall = get_hypercall(info->vm_info, hypercall_id); if (!hcall) { - PrintError("Invalid Hypercall (%d(0x%x) not registered)\n", + PrintError(info->vm_info, info, "Invalid Hypercall (%d(0x%x) not registered) => ignored with rax=-1\n", hypercall_id, hypercall_id); - return -1; + info->vm_regs.rax=-1; + return 0; } - if (hcall->hcall_fn(info, hypercall_id, hcall->priv_data) == 0) { - info->vm_regs.rax = 0; - } else { - info->vm_regs.rax = -1; + if (hcall->hcall_fn(info, hypercall_id, hcall->priv_data) != 0) { + PrintError(info->vm_info, info, "Error handling hypercall\n"); + return -1; } return 0;