aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_misc.c
diff options
context:
space:
mode:
authorJoe Epstein <jepstein98@gmail.com>2011-01-07 11:54:45 +0000
committerJoe Epstein <jepstein98@gmail.com>2011-01-07 11:54:45 +0000
commit81f8af44baecf94a72d08cde1619f5af63c1b3a7 (patch)
treee4567ecb0212bfbd8ca85dd0c2cf01e601ec14c4 /tools/libxc/xc_misc.c
parentb405792883f6e2f3001328865af6960968441ad6 (diff)
downloadxen-81f8af44baecf94a72d08cde1619f5af63c1b3a7.tar.gz
xen-81f8af44baecf94a72d08cde1619f5af63c1b3a7.tar.bz2
xen-81f8af44baecf94a72d08cde1619f5af63c1b3a7.zip
mem_access: HVMOPs for setting mem access
* Creates HVMOPs for setting and getting memory access. The hypercalls can set individual pages or the default access for new/refreshed pages. * Added functions to libxc to access these hypercalls. Signed-off-by: Joe Epstein <jepstein98@gmail.com> Reviewed-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Diffstat (limited to 'tools/libxc/xc_misc.c')
-rw-r--r--tools/libxc/xc_misc.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index 47f97c55f2..f4004b1d82 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -511,6 +511,66 @@ int xc_hvm_set_mem_type(
return rc;
}
+int xc_hvm_set_mem_access(
+ xc_interface *xch, domid_t dom, hvmmem_access_t mem_access, uint64_t first_pfn, uint64_t nr)
+{
+ DECLARE_HYPERCALL;
+ DECLARE_HYPERCALL_BUFFER(struct xen_hvm_set_mem_access, arg);
+ int rc;
+
+ arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg));
+ if ( arg == NULL )
+ {
+ PERROR("Could not allocate memory for xc_hvm_set_mem_access hypercall");
+ return -1;
+ }
+
+ arg->domid = dom;
+ arg->hvmmem_access = mem_access;
+ arg->first_pfn = first_pfn;
+ arg->nr = nr;
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_set_mem_access;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+
+ rc = do_xen_hypercall(xch, &hypercall);
+
+ xc_hypercall_buffer_free(xch, arg);
+
+ return rc;
+}
+
+int xc_hvm_get_mem_access(
+ xc_interface *xch, domid_t dom, uint64_t pfn, hvmmem_access_t* mem_access)
+{
+ DECLARE_HYPERCALL;
+ DECLARE_HYPERCALL_BUFFER(struct xen_hvm_get_mem_access, arg);
+ int rc;
+
+ arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg));
+ if ( arg == NULL )
+ {
+ PERROR("Could not allocate memory for xc_hvm_get_mem_access hypercall");
+ return -1;
+ }
+
+ arg->domid = dom;
+ arg->pfn = pfn;
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_get_mem_access;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+
+ rc = do_xen_hypercall(xch, &hypercall);
+
+ if ( !rc )
+ *mem_access = arg->hvmmem_access;
+
+ xc_hypercall_buffer_free(xch, arg);
+
+ return rc;
+}
/*
* Local variables: