diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-07-21 14:02:53 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-07-21 14:02:53 +0100 |
commit | 19aa4a65a3da6073da990f2845b26b42021db09e (patch) | |
tree | ed2d8b2044ad5af2742ab1944c6339223a5db9db | |
parent | 0bfcf984b727797fb48e19507cd9f00afd1cd65a (diff) | |
download | xen-19aa4a65a3da6073da990f2845b26b42021db09e.tar.gz xen-19aa4a65a3da6073da990f2845b26b42021db09e.tar.bz2 xen-19aa4a65a3da6073da990f2845b26b42021db09e.zip |
libxc: add xc_gnttab_map_domain_grant_refs.
xc_gnttab_map_domain_grant_refs permits to simply map several pages
from the same domain.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
-rw-r--r-- | tools/libxc/xc_linux.c | 23 | ||||
-rw-r--r-- | tools/libxc/xenctrl.h | 17 |
2 files changed, 38 insertions, 2 deletions
diff --git a/tools/libxc/xc_linux.c b/tools/libxc/xc_linux.c index b6f9b82a52..d407299ff8 100644 --- a/tools/libxc/xc_linux.c +++ b/tools/libxc/xc_linux.c @@ -418,9 +418,10 @@ void *xc_gnttab_map_grant_ref(int xcg_handle, return addr; } -void *xc_gnttab_map_grant_refs(int xcg_handle, +static void *do_gnttab_map_grant_refs(int xcg_handle, uint32_t count, uint32_t *domids, + int domids_stride, uint32_t *refs, int prot) { @@ -435,7 +436,7 @@ void *xc_gnttab_map_grant_refs(int xcg_handle, for ( i = 0; i < count; i++ ) { - map->refs[i].domid = domids[i]; + map->refs[i].domid = domids[i * domids_stride]; map->refs[i].ref = refs[i]; } @@ -464,6 +465,24 @@ void *xc_gnttab_map_grant_refs(int xcg_handle, return addr; } +void *xc_gnttab_map_grant_refs(int xcg_handle, + uint32_t count, + uint32_t *domids, + uint32_t *refs, + int prot) +{ + return do_gnttab_map_grant_refs(xcg_handle, count, domids, 1, refs, prot); +} + +void *xc_gnttab_map_domain_grant_refs(int xcg_handle, + uint32_t count, + uint32_t domid, + uint32_t *refs, + int prot) +{ + return do_gnttab_map_grant_refs(xcg_handle, count, &domid, 0, refs, prot); +} + int xc_gnttab_munmap(int xcg_handle, void *start_address, uint32_t count) diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 69d58950d5..2f6aafb0c8 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -865,6 +865,23 @@ void *xc_gnttab_map_grant_refs(int xcg_handle, uint32_t *refs, int prot); +/** + * Memory maps one or more grant references from one domain to a + * contiguous local address range. Mappings should be unmapped with + * xc_gnttab_munmap. Returns NULL on failure. + * + * @parm xcg_handle a handle on an open grant table interface + * @parm count the number of grant references to be mapped + * @parm domid the domain to map memory from + * @parm refs an array of @count grant references to be mapped + * @parm prot same flag as in mmap() + */ +void *xc_gnttab_map_domain_grant_refs(int xcg_handle, + uint32_t count, + uint32_t domid, + uint32_t *refs, + int prot); + /* * Unmaps the @count pages starting at @start_address, which were mapped by a * call to xc_gnttab_map_grant_ref or xc_gnttab_map_grant_refs. Returns zero |