vmmapi.h (268889) | vmmapi.h (269008) |
---|---|
1/*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libvmmapi/vmmapi.h 268889 2014-07-19 20:59:08Z neel $ | 26 * $FreeBSD: head/lib/libvmmapi/vmmapi.h 269008 2014-07-23 04:28:51Z neel $ |
27 */ 28 29#ifndef _VMMAPI_H_ 30#define _VMMAPI_H_ 31 32#include <sys/param.h> 33#include <sys/cpuset.h> 34 --- 26 unchanged lines hidden (view full) --- 61void vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit); 62void vm_set_memflags(struct vmctx *ctx, int flags); 63size_t vm_get_lowmem_size(struct vmctx *ctx); 64size_t vm_get_highmem_size(struct vmctx *ctx); 65int vm_set_desc(struct vmctx *ctx, int vcpu, int reg, 66 uint64_t base, uint32_t limit, uint32_t access); 67int vm_get_desc(struct vmctx *ctx, int vcpu, int reg, 68 uint64_t *base, uint32_t *limit, uint32_t *access); | 27 */ 28 29#ifndef _VMMAPI_H_ 30#define _VMMAPI_H_ 31 32#include <sys/param.h> 33#include <sys/cpuset.h> 34 --- 26 unchanged lines hidden (view full) --- 61void vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit); 62void vm_set_memflags(struct vmctx *ctx, int flags); 63size_t vm_get_lowmem_size(struct vmctx *ctx); 64size_t vm_get_highmem_size(struct vmctx *ctx); 65int vm_set_desc(struct vmctx *ctx, int vcpu, int reg, 66 uint64_t base, uint32_t limit, uint32_t access); 67int vm_get_desc(struct vmctx *ctx, int vcpu, int reg, 68 uint64_t *base, uint32_t *limit, uint32_t *access); |
69int vm_get_seg_desc(struct vmctx *ctx, int vcpu, int reg, 70 struct seg_desc *seg_desc); |
|
69int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val); 70int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval); 71int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, 72 struct vm_exit *ret_vmexit); 73int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how); 74int vm_reinit(struct vmctx *ctx); 75int vm_apicid2vcpu(struct vmctx *ctx, int apicid); 76int vm_inject_exception(struct vmctx *ctx, int vcpu, int vec); --- 42 unchanged lines hidden (view full) --- 119 120int vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities); 121 122/* 123 * Translate the GLA range [gla,gla+len) into GPA segments in 'iov'. 124 * The 'iovcnt' should be big enough to accomodate all GPA segments. 125 * Returns 0 on success, 1 on a guest fault condition and -1 otherwise. 126 */ | 71int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val); 72int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval); 73int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, 74 struct vm_exit *ret_vmexit); 75int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how); 76int vm_reinit(struct vmctx *ctx); 77int vm_apicid2vcpu(struct vmctx *ctx, int apicid); 78int vm_inject_exception(struct vmctx *ctx, int vcpu, int vec); --- 42 unchanged lines hidden (view full) --- 121 122int vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities); 123 124/* 125 * Translate the GLA range [gla,gla+len) into GPA segments in 'iov'. 126 * The 'iovcnt' should be big enough to accomodate all GPA segments. 127 * Returns 0 on success, 1 on a guest fault condition and -1 otherwise. 128 */ |
127int vm_gla2gpa(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging, | 129int vm_copy_setup(struct vmctx *ctx, int vcpu, struct vm_guest_paging *pg, |
128 uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt); 129void vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *guest_iov, 130 void *host_dst, size_t len); 131void vm_copyout(struct vmctx *ctx, int vcpu, const void *host_src, 132 struct iovec *guest_iov, size_t len); 133 | 130 uint64_t gla, size_t len, int prot, struct iovec *iov, int iovcnt); 131void vm_copyin(struct vmctx *ctx, int vcpu, struct iovec *guest_iov, 132 void *host_dst, size_t len); 133void vm_copyout(struct vmctx *ctx, int vcpu, const void *host_src, 134 struct iovec *guest_iov, size_t len); 135 |
136/* Helper functions to inject exceptions */ 137void vm_inject_ss(struct vmctx *ctx, int vcpu, int errcode); 138void vm_inject_ac(struct vmctx *ctx, int vcpu, int errcode); 139void vm_inject_gp(struct vmctx *ctx, int vcpu, int errcode); 140 |
|
134/* Reset vcpu register state */ 135int vcpu_reset(struct vmctx *ctx, int vcpu); 136 137int vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus); 138int vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus); 139int vm_activate_cpu(struct vmctx *ctx, int vcpu); 140 141/* 142 * FreeBSD specific APIs 143 */ 144int vm_setup_freebsd_registers(struct vmctx *ctx, int vcpu, 145 uint64_t rip, uint64_t cr3, uint64_t gdtbase, 146 uint64_t rsp); 147int vm_setup_freebsd_registers_i386(struct vmctx *vmctx, int vcpu, 148 uint32_t eip, uint32_t gdtbase, 149 uint32_t esp); 150void vm_setup_freebsd_gdt(uint64_t *gdtr); 151#endif /* _VMMAPI_H_ */ | 141/* Reset vcpu register state */ 142int vcpu_reset(struct vmctx *ctx, int vcpu); 143 144int vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus); 145int vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus); 146int vm_activate_cpu(struct vmctx *ctx, int vcpu); 147 148/* 149 * FreeBSD specific APIs 150 */ 151int vm_setup_freebsd_registers(struct vmctx *ctx, int vcpu, 152 uint64_t rip, uint64_t cr3, uint64_t gdtbase, 153 uint64_t rsp); 154int vm_setup_freebsd_registers_i386(struct vmctx *vmctx, int vcpu, 155 uint32_t eip, uint32_t gdtbase, 156 uint32_t esp); 157void vm_setup_freebsd_gdt(uint64_t *gdtr); 158#endif /* _VMMAPI_H_ */ |