# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1169088584 -32400
# Node ID 9d5b9b6ff32744c912c44cfb9944646224923628
# Parent c2db94de4afc030170609d7d9de6daf334b17182
libxc: add xc_domain_translate_gpfn for XENMEM_translate_gpfn_list
which is used by dump-core ia64 support.
PATCHNAME: dump_core_xc_domain_translate_gpfn
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
diff -r c2db94de4afc -r 9d5b9b6ff327 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Thu Jan 18 15:13:11 2007 +0900
+++ b/tools/libxc/xc_domain.c Thu Jan 18 11:49:44 2007 +0900
@@ -556,6 +556,30 @@ int xc_domain_memory_populate_physmap(in
err = -1;
}
+ return err;
+}
+
+int xc_domain_translate_gpfn(int xc_handle,
+ uint32_t domid,
+ unsigned long nr_gpfns,
+ xen_pfn_t *gpfn_list,
+ xen_pfn_t *mfn_list)
+{
+ int err;
+ struct xen_translate_gpfn_list translate = {
+ .domid = domid,
+ .nr_gpfns = nr_gpfns
+ };
+ set_xen_guest_handle(translate.gpfn_list, gpfn_list);
+ set_xen_guest_handle(translate.mfn_list, mfn_list);
+ err = xc_memory_op(xc_handle, XENMEM_translate_gpfn_list, &translate);
+ if ( err )
+ {
+ DPRINTF("Failed to translate for dom %d: %ld gpfns\n",
+ domid, nr_gpfns);
+ errno = -err;
+ }
+
return err;
}
diff -r c2db94de4afc -r 9d5b9b6ff327 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Thu Jan 18 15:13:11 2007 +0900
+++ b/tools/libxc/xc_private.c Thu Jan 18 11:49:44 2007 +0900
@@ -210,6 +210,7 @@ int xc_memory_op(int xc_handle,
DECLARE_HYPERCALL;
struct xen_memory_reservation *reservation = arg;
struct xen_machphys_mfn_list *xmml = arg;
+ struct xen_translate_gpfn_list *translate = arg;
xen_pfn_t *extent_start;
long ret = -EINVAL;
@@ -256,6 +257,32 @@ int xc_memory_op(int xc_handle,
if ( lock_pages(arg, sizeof(struct xen_add_to_physmap)) )
{
PERROR("Could not lock");
+ goto out1;
+ }
+ break;
+ case XENMEM_translate_gpfn_list:
+ if ( lock_pages(translate, sizeof(*translate)) != 0 )
+ {
+ PERROR("Coult not lock");
+ goto out1;
+ }
+ get_xen_guest_handle(extent_start, translate->gpfn_list);
+ if ( lock_pages(extent_start,
+ translate->nr_gpfns * sizeof(xen_pfn_t)) )
+ {
+ PERROR("Coult not lock");
+ unlock_pages(translate, sizeof(*translate));
+ goto out1;
+ }
+ get_xen_guest_handle(extent_start, translate->mfn_list);
+ if ( lock_pages(extent_start,
+ translate->nr_gpfns * sizeof(xen_pfn_t)) )
+ {
+ PERROR("Coult not lock");
+ unlock_pages(translate, sizeof(*translate));
+ get_xen_guest_handle(extent_start, translate->gpfn_list);
+ unlock_pages(extent_start,
+ translate->nr_gpfns * sizeof(xen_pfn_t));
goto out1;
}
break;
@@ -282,6 +309,13 @@ int xc_memory_op(int xc_handle,
break;
case XENMEM_add_to_physmap:
unlock_pages(arg, sizeof(struct xen_add_to_physmap));
+ break;
+ case XENMEM_translate_gpfn_list:
+ unlock_pages(translate, sizeof(*translate));
+ get_xen_guest_handle(extent_start, translate->gpfn_list);
+ unlock_pages(extent_start, translate->nr_gpfns * sizeof(xen_pfn_t));
+ get_xen_guest_handle(extent_start, translate->mfn_list);
+ unlock_pages(extent_start, translate->nr_gpfns * sizeof(xen_pfn_t));
break;
}
diff -r c2db94de4afc -r 9d5b9b6ff327 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Thu Jan 18 15:13:11 2007 +0900
+++ b/tools/libxc/xenctrl.h Thu Jan 18 11:49:44 2007 +0900
@@ -457,6 +457,12 @@ int xc_domain_memory_populate_physmap(in
unsigned int address_bits,
xen_pfn_t *extent_start);
+int xc_domain_translate_gpfn(int xc_handle,
+ uint32_t domid,
+ unsigned long nr_gpfns,
+ xen_pfn_t *gpfn_list,
+ xen_pfn_t *mfn_list);
+
int xc_domain_ioport_permission(int xc_handle,
uint32_t domid,
uint32_t first_port,
--
yamahata
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|