Deleted Added
full compact
vmmapi.c (245678) vmmapi.c (246686)
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.c 245678 2013-01-20 03:42:49Z neel $
26 * $FreeBSD: head/lib/libvmmapi/vmmapi.c 246686 2013-02-11 20:36:07Z neel $
27 */
28
29#include <sys/cdefs.h>
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/lib/libvmmapi/vmmapi.c 245678 2013-01-20 03:42:49Z neel $");
30__FBSDID("$FreeBSD: head/lib/libvmmapi/vmmapi.c 246686 2013-02-11 20:36:07Z neel $");
31
32#include <sys/types.h>
33#include <sys/sysctl.h>
34#include <sys/ioctl.h>
35#include <sys/mman.h>
36
37#include <machine/specialreg.h>
38

--- 206 unchanged lines hidden (view full) ---

245 vmreg.regnum = reg;
246
247 error = ioctl(ctx->fd, VM_GET_REGISTER, &vmreg);
248 *ret_val = vmreg.regval;
249 return (error);
250}
251
252int
31
32#include <sys/types.h>
33#include <sys/sysctl.h>
34#include <sys/ioctl.h>
35#include <sys/mman.h>
36
37#include <machine/specialreg.h>
38

--- 206 unchanged lines hidden (view full) ---

245 vmreg.regnum = reg;
246
247 error = ioctl(ctx->fd, VM_GET_REGISTER, &vmreg);
248 *ret_val = vmreg.regval;
249 return (error);
250}
251
252int
253vm_get_pinning(struct vmctx *ctx, int vcpu, int *host_cpuid)
254{
255 int error;
256 struct vm_pin vmpin;
257
258 bzero(&vmpin, sizeof(vmpin));
259 vmpin.vm_cpuid = vcpu;
260
261 error = ioctl(ctx->fd, VM_GET_PINNING, &vmpin);
262 *host_cpuid = vmpin.host_cpuid;
263 return (error);
264}
265
266int
267vm_set_pinning(struct vmctx *ctx, int vcpu, int host_cpuid)
268{
269 int error;
270 struct vm_pin vmpin;
271
272 bzero(&vmpin, sizeof(vmpin));
273 vmpin.vm_cpuid = vcpu;
274 vmpin.host_cpuid = host_cpuid;
275
276 error = ioctl(ctx->fd, VM_SET_PINNING, &vmpin);
277 return (error);
278}
279
280int
281vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *vmexit)
282{
283 int error;
284 struct vm_run vmrun;
285
286 bzero(&vmrun, sizeof(vmrun));
287 vmrun.cpuid = vcpu;
288 vmrun.rip = rip;

--- 435 unchanged lines hidden ---
253vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *vmexit)
254{
255 int error;
256 struct vm_run vmrun;
257
258 bzero(&vmrun, sizeof(vmrun));
259 vmrun.cpuid = vcpu;
260 vmrun.rip = rip;

--- 435 unchanged lines hidden ---