diff options
author | neel <neel@FreeBSD.org> | 2014-07-23 04:28:51 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2014-07-23 04:28:51 +0000 |
commit | e972917c13728442e9cd66ca3f86623f7f7ab351 (patch) | |
tree | 0b8a520e692386324f53c5972af0ec0ef5523d3c /lib/libvmmapi/vmmapi.c | |
parent | 607bced4fa031f2dbd13539133b0971e2034c49e (diff) | |
download | FreeBSD-src-e972917c13728442e9cd66ca3f86623f7f7ab351.zip FreeBSD-src-e972917c13728442e9cd66ca3f86623f7f7ab351.tar.gz |
Emulate instructions emitted by OpenBSD/i386 version 5.5:
- CMP REG, r/m
- MOV AX/EAX/RAX, moffset
- MOV moffset, AX/EAX/RAX
- PUSH r/m
Diffstat (limited to 'lib/libvmmapi/vmmapi.c')
-rw-r--r-- | lib/libvmmapi/vmmapi.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 483aa51..087d0b7 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <sys/_iovec.h> #include <sys/cpuset.h> +#include <x86/segments.h> #include <machine/specialreg.h> #include <machine/param.h> @@ -327,6 +328,16 @@ vm_get_desc(struct vmctx *ctx, int vcpu, int reg, } int +vm_get_seg_desc(struct vmctx *ctx, int vcpu, int reg, struct seg_desc *seg_desc) +{ + int error; + + error = vm_get_desc(ctx, vcpu, reg, &seg_desc->base, &seg_desc->limit, + &seg_desc->access); + return (error); +} + +int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val) { int error; @@ -988,7 +999,7 @@ gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, #endif int -vm_gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, +vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt) { uint64_t gpa; @@ -1135,3 +1146,30 @@ 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); +} |