Deleted Added
full compact
vmmapi.c (268976) vmmapi.c (270070)
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: stable/10/lib/libvmmapi/vmmapi.c 268976 2014-07-22 04:39:16Z jhb $
26 * $FreeBSD: stable/10/lib/libvmmapi/vmmapi.c 270070 2014-08-17 00:52:07Z grehan $
27 */
28
29#include <sys/cdefs.h>
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/10/lib/libvmmapi/vmmapi.c 268976 2014-07-22 04:39:16Z jhb $");
30__FBSDID("$FreeBSD: stable/10/lib/libvmmapi/vmmapi.c 270070 2014-08-17 00:52:07Z grehan $");
31
31
32#include <sys/types.h>
32#include <sys/param.h>
33#include <sys/sysctl.h>
34#include <sys/ioctl.h>
35#include <sys/mman.h>
36#include <sys/_iovec.h>
33#include <sys/sysctl.h>
34#include <sys/ioctl.h>
35#include <sys/mman.h>
36#include <sys/_iovec.h>
37#include <sys/cpuset.h>
37
38#include <machine/specialreg.h>
39#include <machine/param.h>
40
41#include <stdio.h>
42#include <stdlib.h>
43#include <assert.h>
44#include <string.h>

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

1038 dst = vm_map_gpa(ctx, gpa, n);
1039 bcopy(src, dst, n);
1040
1041 iov++;
1042 src += n;
1043 len -= n;
1044 }
1045}
38
39#include <machine/specialreg.h>
40#include <machine/param.h>
41
42#include <stdio.h>
43#include <stdlib.h>
44#include <assert.h>
45#include <string.h>

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

1039 dst = vm_map_gpa(ctx, gpa, n);
1040 bcopy(src, dst, n);
1041
1042 iov++;
1043 src += n;
1044 len -= n;
1045 }
1046}
1047
1048static int
1049vm_get_cpus(struct vmctx *ctx, int which, cpuset_t *cpus)
1050{
1051 struct vm_cpuset vm_cpuset;
1052 int error;
1053
1054 bzero(&vm_cpuset, sizeof(struct vm_cpuset));
1055 vm_cpuset.which = which;
1056 vm_cpuset.cpusetsize = sizeof(cpuset_t);
1057 vm_cpuset.cpus = cpus;
1058
1059 error = ioctl(ctx->fd, VM_GET_CPUS, &vm_cpuset);
1060 return (error);
1061}
1062
1063int
1064vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus)
1065{
1066
1067 return (vm_get_cpus(ctx, VM_ACTIVE_CPUS, cpus));
1068}
1069
1070int
1071vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus)
1072{
1073
1074 return (vm_get_cpus(ctx, VM_SUSPENDED_CPUS, cpus));
1075}
1076
1077int
1078vm_activate_cpu(struct vmctx *ctx, int vcpu)
1079{
1080 struct vm_activate_cpu ac;
1081 int error;
1082
1083 bzero(&ac, sizeof(struct vm_activate_cpu));
1084 ac.vcpuid = vcpu;
1085 error = ioctl(ctx->fd, VM_ACTIVATE_CPU, &ac);
1086 return (error);
1087}