WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-devel] [PATCH 2/5] dump-core take 2: libxc: xc_domain memmap functi

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2/5] dump-core take 2: libxc: xc_domain memmap functions
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Thu, 18 Jan 2007 15:52:52 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx, Dave Anderson <anderson@xxxxxxxxxx>, John Levon <levon@xxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 17 Jan 2007 22:53:04 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070118065242.4302.39670.sendpatchset@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20070118065242.4302.39670.sendpatchset@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1169100791 -32400
# Node ID c2db94de4afc030170609d7d9de6daf334b17182
# Parent  280d35294b8968b262c37df4d01712e0af288451
libxc:add xc_domain_set_memmap(), xc_domain_get_memmap() which is corresponding
to XENMEM_set_memory_map and XENMEM_get_memory_map.
dump-core needs those functions.
PATCHNAME: libxc_memory_map

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r 280d35294b89 -r c2db94de4afc tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Tue Jan 16 15:40:39 2007 +0900
+++ b/tools/libxc/xc_domain.c   Thu Jan 18 15:13:11 2007 +0900
@@ -351,10 +351,93 @@ int xc_domain_set_memmap_limit(int xc_ha
     unlock_pages(&e820, sizeof(e820));
     return rc;
 }
+
+int xc_domain_set_memmap(int xc_handle,
+                         uint32_t domid,
+                         void *buffer,
+                         unsigned int nr_entries)
+{
+    int rc;
+
+    struct xen_foreign_memory_map fmap = {
+        .domid = domid,
+        .map = { .nr_entries = nr_entries }
+    };
+
+    set_xen_guest_handle(fmap.map.buffer, buffer);
+
+    if ( lock_pages(&fmap, sizeof(fmap)) ||
+         lock_pages(buffer, nr_entries * sizeof(struct e820entry)) )
+    {
+        PERROR("Could not lock memory for Xen hypercall");
+        rc = -1;
+        goto out;
+    }
+
+    rc = xc_memory_op(xc_handle, XENMEM_set_memory_map, &fmap);
+
+ out:
+    unlock_pages(&fmap, sizeof(fmap));
+    unlock_pages(buffer, nr_entries * sizeof(struct e820entry));
+    return rc;
+}
+
+int xc_domain_get_memmap(int xc_handle,
+                         uint32_t domid,
+                         void *buffer,
+                         unsigned int *nr_entries)
+{
+    int rc;
+
+    struct xen_foreign_memory_map fmap = {
+        .domid = domid,
+        .map = { .nr_entries = *nr_entries }
+    };
+
+    set_xen_guest_handle(fmap.map.buffer, buffer);
+
+    if ( lock_pages(&fmap, sizeof(fmap)) ||
+         lock_pages(buffer, *nr_entries * sizeof(struct e820entry)) )
+    {
+        PERROR("Could not lock memory for Xen hypercall");
+        rc = -1;
+        goto out;
+    }
+
+    rc = xc_memory_op(xc_handle, XENMEM_get_memory_map, &fmap);
+
+ out:
+    unlock_pages(&fmap, sizeof(fmap));
+    unlock_pages(buffer, *nr_entries * sizeof(struct e820entry));
+
+    *nr_entries = fmap.map.nr_entries;
+    return rc;
+    
+}
 #else
 int xc_domain_set_memmap_limit(int xc_handle,
                                uint32_t domid,
                                unsigned long map_limitkb)
+{
+    PERROR("Function not implemented");
+    errno = ENOSYS;
+    return -1;
+}
+
+int xc_domain_set_memmap(int xc_handle,
+                         uint32_t domid,
+                         void *buffer,
+                         unsigned int nr_entries)
+{
+    PERROR("Function not implemented");
+    errno = ENOSYS;
+    return -1;
+}
+
+int xc_domain_get_memmap(int xc_handle,
+                         uint32_t domid,
+                         void *buffer,
+                         unsigned int nr_entries)
 {
     PERROR("Function not implemented");
     errno = ENOSYS;
diff -r 280d35294b89 -r c2db94de4afc tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Tue Jan 16 15:40:39 2007 +0900
+++ b/tools/libxc/xenctrl.h     Thu Jan 18 15:13:11 2007 +0900
@@ -423,6 +423,16 @@ int xc_domain_set_memmap_limit(int xc_ha
                                uint32_t domid,
                                unsigned long map_limitkb);
 
+int xc_domain_set_memmap(int xc_handle,
+                         uint32_t domid,
+                         void *buffer,
+                         unsigned int nr_entries);
+
+int xc_domain_get_memmap(int xc_handle,
+                         uint32_t domid,
+                         void *buffer,
+                         unsigned int *nr_entries);
+
 int xc_domain_set_time_offset(int xc_handle,
                               uint32_t domid,
                               int32_t time_offset_seconds);
--
yamahata

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel