[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] New memory_op subops which return the apparent or actual physical address map.



# HG changeset patch
# User Ian.Campbell@xxxxxxxxxxxxx
# Node ID 810ad61870e8c61a4e9ed096c4f73ab62048183b
# Parent  ebfa1046a81f2243c9742ef0c5f99ccd255f99e5
New memory_op subops which return the apparent or actual physical address map.

The new subops return a memory map in e820 format. This will allow the
removal of some Xen special casing in the Linux port by using the same
code as native.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm.c           |   35 +++++++++++++++++++++++++++++++++++
 xen/include/public/memory.h |   28 ++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)

diff -r ebfa1046a81f -r 810ad61870e8 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Mon May 22 09:21:58 2006 +0100
+++ b/xen/arch/x86/mm.c Mon May 22 09:22:18 2006 +0100
@@ -2811,6 +2811,8 @@ long do_update_descriptor(u64 pa, u64 de
     return ret;
 }
 
+typedef struct e820entry e820entry_t;
+DEFINE_XEN_GUEST_HANDLE(e820entry_t);
 
 long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
 {
@@ -2867,6 +2869,39 @@ long arch_memory_op(int op, XEN_GUEST_HA
         put_domain(d);
 
         break;
+    }
+
+    case XENMEM_memory_map:
+    {
+        return -ENOSYS;
+    }
+
+    case XENMEM_machine_memory_map:
+    {
+        struct xen_memory_map memmap;
+        XEN_GUEST_HANDLE(e820entry_t) buffer;
+        int count;
+
+        if ( !IS_PRIV(current->domain) )
+            return -EINVAL;
+
+        if ( copy_from_guest(&memmap, arg, 1) )
+            return -EFAULT;
+        if ( memmap.nr_entries < e820.nr_map + 1 )
+            return -EINVAL;
+
+        buffer = guest_handle_cast(memmap.buffer, e820entry_t);
+
+        count = min((unsigned int)e820.nr_map, memmap.nr_entries);
+        if ( copy_to_guest(buffer, &e820.map[0], count) < 0 )
+            return -EFAULT;
+
+        memmap.nr_entries = count;
+
+        if ( copy_to_guest(arg, &memmap, 1) )
+            return -EFAULT;
+
+        return 0;
     }
 
     default:
diff -r ebfa1046a81f -r 810ad61870e8 xen/include/public/memory.h
--- a/xen/include/public/memory.h       Mon May 22 09:21:58 2006 +0100
+++ b/xen/include/public/memory.h       Mon May 22 09:22:18 2006 +0100
@@ -146,6 +146,34 @@ typedef struct xen_translate_gpfn_list x
 typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
 DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
 
+/*
+ * Returns the pseudo-physical memory map as it was when the domain
+ * was started.
+ */
+#define XENMEM_memory_map           9
+struct xen_memory_map {
+    /*
+     * On call the number of entries which can be stored in buffer. On
+     * return the number of entries which have been stored in
+     * buffer.
+     */
+    unsigned int nr_entries;
+
+    /*
+     * Entries in the buffer are in the same format as returned by the
+     * BIOS INT 0x15 EAX=0xE820 call.
+     */
+    XEN_GUEST_HANDLE(void) buffer;
+};
+typedef struct xen_memory_map xen_memory_map_t;
+DEFINE_XEN_GUEST_HANDLE(xen_memory_map_t);
+
+/*
+ * Returns the real physical memory map. Passes the same structure as
+ * XENMEM_memory_map.
+ */
+#define XENMEM_machine_memory_map      10
+
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
 
 /*

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.