From: mlarkin Date: Wed, 11 Jul 2018 12:45:01 +0000 (+0000) Subject: vmm(4): small cleanup in vm_rwregs. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fb5430e03c911b50c5122a2f4179fdb00dc41c39;p=openbsd vmm(4): small cleanup in vm_rwregs. Clarify error values and change a panic into a debug printf (which will in turn just kill the VM). --- diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 6cbad01f200..c405ade5a4f 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.210 2018/07/10 09:04:22 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.211 2018/07/11 12:45:01 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -653,13 +653,14 @@ vm_intr_pending(struct vm_intr_params *vip) * * Parameters: * vrwp: Describes the VM and VCPU to get/set the registers from. The - * register values are returned here as well. + * register values are returned here as well. * dir: 0 for reading, 1 for writing * * Return values: * 0: if successful - * ENOENT: if the VM/VCPU defined by 'vgp' cannot be found - * EINVAL: if an error occured reading the registers of the guest + * ENOENT: if the VM/VCPU defined by 'vrwp' cannot be found + * EINVAL: if an error occured accessing the registers of the guest + * EPERM: if the vm cannot be accessed from the calling process */ int vm_rwregs(struct vm_rwregs_params *vrwp, int dir) @@ -700,8 +701,10 @@ vm_rwregs(struct vm_rwregs_params *vrwp, int dir) return (dir == 0) ? vcpu_readregs_svm(vcpu, vrwp->vrwp_mask, vrs) : vcpu_writeregs_svm(vcpu, vrwp->vrwp_mask, vrs); - else - panic("unknown vmm mode"); + else { + DPRINTF("%s: unknown vmm mode", __func__); + return (EINVAL); + } } /*