aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2010-10-22 15:14:51 +0100
committerIan Campbell <ian.campbell@citrix.com>2010-10-22 15:14:51 +0100
commit2dee7f052d76319ca4de0772f112f08e8c6338dd (patch)
treeaacb50ed234f37f9bf0681e23d20da6621a3ebcb /tools
parent70a0e72f0b126fe7dc99bf5fea149a8ae9d9dc26 (diff)
downloadxen-2dee7f052d76319ca4de0772f112f08e8c6338dd.tar.gz
xen-2dee7f052d76319ca4de0772f112f08e8c6338dd.tar.bz2
xen-2dee7f052d76319ca4de0772f112f08e8c6338dd.zip
libxc: convert ia64 dom0vp interface to hypercall buffers
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/libxc/ia64/xc_dom_ia64_util.c16
-rw-r--r--tools/libxc/ia64/xc_ia64_stubs.c32
2 files changed, 27 insertions, 21 deletions
diff --git a/tools/libxc/ia64/xc_dom_ia64_util.c b/tools/libxc/ia64/xc_dom_ia64_util.c
index cd12d42b47..bc83dbb841 100644
--- a/tools/libxc/ia64/xc_dom_ia64_util.c
+++ b/tools/libxc/ia64/xc_dom_ia64_util.c
@@ -36,19 +36,21 @@ xen_ia64_fpswa_revision(struct xc_dom_image *dom, unsigned int *revision)
{
int ret;
DECLARE_HYPERCALL;
- hypercall.op = __HYPERVISOR_ia64_dom0vp_op;
- hypercall.arg[0] = IA64_DOM0VP_fpswa_revision;
- hypercall.arg[1] = (unsigned long)revision;
+ DECLARE_HYPERCALL_BOUNCE(revision, sizeof(*revision), XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
- if (lock_pages(revision, sizeof(*revision)) != 0) {
- xc_interface *xch = dom->xch;
+ if (xc_hypercall_bounce_pre(dom->xch, revision) )
+ {
PERROR("Could not lock memory for xen fpswa hypercall");
return -1;
}
+ hypercall.op = __HYPERVISOR_ia64_dom0vp_op;
+ hypercall.arg[0] = IA64_DOM0VP_fpswa_revision;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(revision);
+
ret = do_xen_hypercall(dom->xch, &hypercall);
-
- unlock_pages(revision, sizeof(*revision));
+
+ xc_hypercall_bounce_post(dom->xch, revision);
return ret;
}
diff --git a/tools/libxc/ia64/xc_ia64_stubs.c b/tools/libxc/ia64/xc_ia64_stubs.c
index d7dd89b467..9691acb03e 100644
--- a/tools/libxc/ia64/xc_ia64_stubs.c
+++ b/tools/libxc/ia64/xc_ia64_stubs.c
@@ -42,19 +42,24 @@ xc_ia64_get_memmap(xc_interface *xch,
uint32_t domid, char *buf, unsigned long bufsize)
{
privcmd_hypercall_t hypercall;
+ DECLARE_HYPERCALL_BOUNCE(buf, bufsize, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
int ret;
+ if ( xc_hypercall_bounce_pre(xch, pfn_buf) )
+ {
+ PERROR("xc_get_pfn_list: pfn_buf bounce failed");
+ return -1;
+ }
+
hypercall.op = __HYPERVISOR_ia64_dom0vp_op;
hypercall.arg[0] = IA64_DOM0VP_get_memmap;
hypercall.arg[1] = domid;
- hypercall.arg[2] = (unsigned long)buf;
+ hypercall.arg[2] = HYPERCALL_BUFFER_AS_ARG(buf);
hypercall.arg[3] = bufsize;
hypercall.arg[4] = 0;
- if (lock_pages(buf, bufsize) != 0)
- return -1;
ret = do_xen_hypercall(xch, &hypercall);
- unlock_pages(buf, bufsize);
+ xc_hypercall_bounce_post(xc, buf);
return ret;
}
@@ -142,6 +147,7 @@ xc_ia64_map_foreign_p2m(xc_interface *xch, uint32_t dom,
struct xen_ia64_memmap_info *memmap_info,
unsigned long flags, unsigned long *p2m_size_p)
{
+ DECLARE_HYPERCALL_BOUNCE(memmap_info, sizeof(*memmap_info) + memmap_info->efi_memmap_size, XC_HYPERCALL_BOUNCE_BUFFER_IN);
unsigned long gpfn_max;
unsigned long p2m_size;
void *addr;
@@ -157,25 +163,23 @@ xc_ia64_map_foreign_p2m(xc_interface *xch, uint32_t dom,
addr = mmap(NULL, p2m_size, PROT_READ, MAP_SHARED, xch->fd, 0);
if (addr == MAP_FAILED)
return NULL;
+ if (xc_hypercall_bounce_pre(xc, memmap_info)) {
+ saved_errno = errno;
+ munmap(addr, p2m_size);
+ errno = saved_errno;
+ return NULL;
+ }
hypercall.op = __HYPERVISOR_ia64_dom0vp_op;
hypercall.arg[0] = IA64_DOM0VP_expose_foreign_p2m;
hypercall.arg[1] = (unsigned long)addr;
hypercall.arg[2] = dom;
- hypercall.arg[3] = (unsigned long)memmap_info;
+ hypercall.arg[3] = HYPERCALL_BUFFER_AS_ARG(memmap_info);
hypercall.arg[4] = flags;
- if (lock_pages(memmap_info,
- sizeof(*memmap_info) + memmap_info->efi_memmap_size) != 0) {
- saved_errno = errno;
- munmap(addr, p2m_size);
- errno = saved_errno;
- return NULL;
- }
ret = do_xen_hypercall(xch, &hypercall);
saved_errno = errno;
- unlock_pages(memmap_info,
- sizeof(*memmap_info) + memmap_info->efi_memmap_size);
+ xc_hypercall_bounce_post(xch, memmap_info);
if (ret < 0) {
munmap(addr, p2m_size);
errno = saved_errno;