summaryrefslogtreecommitdiffstats
path: root/lib/libvmmapi
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2014-07-24 01:38:11 +0000
committerneel <neel@FreeBSD.org>2014-07-24 01:38:11 +0000
commit4535fa67c47e242c2d4c579630ebc12d8153d881 (patch)
treef10160daba1a9c8df5c059e74db7b03dcae6f007 /lib/libvmmapi
parent57fd2f85267f7e1a29e8cef251c560081842963b (diff)
downloadFreeBSD-src-4535fa67c47e242c2d4c579630ebc12d8153d881.zip
FreeBSD-src-4535fa67c47e242c2d4c579630ebc12d8153d881.tar.gz
Fix fault injection in bhyve.
The faulting instruction needs to be restarted when the exception handler is done handling the fault. bhyve now does this correctly by setting 'vmexit[vcpu].inst_length' to zero so the %rip is not advanced. A minor complication is that the fault injection APIs are used by instruction emulation code that is shared by vmm.ko and bhyve. Thus the argument that refers to 'struct vm *' in kernel or 'struct vmctx *' in userspace needs to be loosely typed as a 'void *'.
Diffstat (limited to 'lib/libvmmapi')
-rw-r--r--lib/libvmmapi/vmmapi.c27
-rw-r--r--lib/libvmmapi/vmmapi.h5
2 files changed, 0 insertions, 32 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index 087d0b7..93955c7 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -1146,30 +1146,3 @@ vm_set_intinfo(struct vmctx *ctx, int vcpu, uint64_t info1)
error = ioctl(ctx->fd, VM_SET_INTINFO, &vmii);
return (error);
}
-
-void
-vm_inject_ss(struct vmctx *ctx, int vcpu, int errcode)
-{
- int error;
-
- error = vm_inject_exception2(ctx, vcpu, IDT_SS, errcode);
- assert(error == 0);
-}
-
-void
-vm_inject_ac(struct vmctx *ctx, int vcpu, int errcode)
-{
- int error;
-
- error = vm_inject_exception2(ctx, vcpu, IDT_AC, errcode);
- assert(error == 0);
-}
-
-void
-vm_inject_gp(struct vmctx *ctx, int vcpu, int errcode)
-{
- int error;
-
- error = vm_inject_exception2(ctx, vcpu, IDT_GP, errcode);
- assert(error == 0);
-}
diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h
index 72d75c0..fbb6ddd 100644
--- a/lib/libvmmapi/vmmapi.h
+++ b/lib/libvmmapi/vmmapi.h
@@ -133,11 +133,6 @@ void vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *guest_iov,
void vm_copyout(struct vmctx *ctx, int vcpu, const void *host_src,
struct iovec *guest_iov, size_t len);
-/* Helper functions to inject exceptions */
-void vm_inject_ss(struct vmctx *ctx, int vcpu, int errcode);
-void vm_inject_ac(struct vmctx *ctx, int vcpu, int errcode);
-void vm_inject_gp(struct vmctx *ctx, int vcpu, int errcode);
-
/* Reset vcpu register state */
int vcpu_reset(struct vmctx *ctx, int vcpu);
OpenPOWER on IntegriCloud