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

[Xen-changelog] [xen-unstable] mini-os: export allocate_ondemand



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1216392306 -3600
# Node ID d85714c0a742b4cee4e93888b1ea740f0d9b8c4f
# Parent  60828077e1759c3a9d9506067597a8c1330c4afb
mini-os: export allocate_ondemand

allocate_ondemand can be used to allocate addresse space. Primarily
used for mapping MFNs, it can also be used e.g. to map grant refs.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/arch/ia64/mm.c |    5 +++++
 extras/mini-os/arch/x86/mm.c  |   23 ++++++++++++++++-------
 extras/mini-os/include/mm.h   |    1 +
 3 files changed, 22 insertions(+), 7 deletions(-)

diff -r 60828077e175 -r d85714c0a742 extras/mini-os/arch/ia64/mm.c
--- a/extras/mini-os/arch/ia64/mm.c     Fri Jul 18 15:44:39 2008 +0100
+++ b/extras/mini-os/arch/ia64/mm.c     Fri Jul 18 15:45:06 2008 +0100
@@ -130,6 +130,11 @@ arch_init_demand_mapping_area(unsigned l
        max_pfn = max_pfn;
 }
 
+unsigned long allocate_ondemand(unsigned long n, unsigned long alignment)
+{
+        return 0;
+}
+
 /* Helper function used in gnttab.c. */
 void do_map_frames(unsigned long addr,
         unsigned long *f, unsigned long n, unsigned long stride,
diff -r 60828077e175 -r d85714c0a742 extras/mini-os/arch/x86/mm.c
--- a/extras/mini-os/arch/x86/mm.c      Fri Jul 18 15:44:39 2008 +0100
+++ b/extras/mini-os/arch/x86/mm.c      Fri Jul 18 15:45:06 2008 +0100
@@ -492,9 +492,7 @@ void do_map_frames(unsigned long addr,
     }
 }
 
-void *map_frames_ex(unsigned long *f, unsigned long n, unsigned long stride,
-       unsigned long increment, unsigned long alignment, domid_t id,
-       int may_fail, unsigned long prot)
+unsigned long allocate_ondemand(unsigned long n, unsigned long alignment)
 {
     unsigned long x;
     unsigned long y = 0;
@@ -517,13 +515,24 @@ void *map_frames_ex(unsigned long *f, un
     }
     if (y != n) {
         printk("Failed to find %ld frames!\n", n);
+        return 0;
+    }
+    return demand_map_area_start + x * PAGE_SIZE;
+}
+
+void *map_frames_ex(unsigned long *f, unsigned long n, unsigned long stride,
+       unsigned long increment, unsigned long alignment, domid_t id,
+       int may_fail, unsigned long prot)
+{
+    unsigned long addr = allocate_ondemand(n, alignment);
+
+    if (!addr)
         return NULL;
-    }
 
     /* Found it at x.  Map it in. */
-    do_map_frames(demand_map_area_start + x * PAGE_SIZE, f, n, stride, 
increment, id, may_fail, prot);
-
-    return (void *)(unsigned long)(demand_map_area_start + x * PAGE_SIZE);
+    do_map_frames(addr, f, n, stride, increment, id, may_fail, prot);
+
+    return (void *)addr;
 }
 
 static void clear_bootstrap(void)
diff -r 60828077e175 -r d85714c0a742 extras/mini-os/include/mm.h
--- a/extras/mini-os/include/mm.h       Fri Jul 18 15:44:39 2008 +0100
+++ b/extras/mini-os/include/mm.h       Fri Jul 18 15:45:06 2008 +0100
@@ -63,6 +63,7 @@ void arch_init_mm(unsigned long* start_p
 void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p);
 void arch_init_p2m(unsigned long max_pfn_p);
 
+unsigned long allocate_ondemand(unsigned long n, unsigned long alignment);
 /* map f[i*stride]+i*increment for i in 0..n-1, aligned on alignment pages */
 void *map_frames_ex(unsigned long *f, unsigned long n, unsigned long stride,
        unsigned long increment, unsigned long alignment, domid_t id,

_______________________________________________
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®.