Skip to contentSkip to conversation

minios: allocate machine contiguous pages

PATCH In review Rolf Neugebauer 2 participants 2 messages Mar 12, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 minios: allocate machine contiguous pages

This is a port of XenLinux xen_alloc_contig_memory() to mini-os. A sufficiently privileged mini-os guest can exchange a small number of its pages with machine contiguous pages.

extras/mini-os/arch/ia64/mm.c +6 -0
diff -r 3a0165b48266 extras/mini-os/arch/ia64/mm.c
@@ -162,6 +162,12 @@
     ASSERT(0);
 }
 
+unsigned long alloc_contig_pages(int order, unsigned int addr_bits)
+{
+    /* TODO */
+    ASSERT(0);
+}
+
 void arch_init_p2m(unsigned long max_pfn)
 {
     printk("Warn: p2m map not implemented.\n");
extras/mini-os/arch/x86/mm.c +142 -0

148 lines not on this page · raw message

extras/mini-os/include/mm.h +1 -0
diff -r 3a0165b48266 extras/mini-os/include/mm.h
@@ -72,6 +72,7 @@
         unsigned long *f, unsigned long n, unsigned long stride,
 	unsigned long increment, domid_t id, int may_fail, unsigned long prot);
 int unmap_frames(unsigned long va, unsigned long num_frames);
+unsigned long alloc_contig_pages(int order, unsigned int addr_bits);
 #ifdef HAVE_LIBC
 extern unsigned long heap, brk, heap_mapped, heap_end;
 #endif
extras/mini-os/include/x86/arch_mm.h +3 -0
diff -r 3a0165b48266 extras/mini-os/include/x86/arch_mm.h
@@ -137,6 +137,9 @@
 #define IO_PROT (L1_PROT)
 #define IO_PROT_NOCACHE (L1_PROT | _PAGE_PCD)
 
+/* for P2M */
+#define INVALID_P2M_ENTRY (~0UL)
+
 #include "arch_limits.h"
 #define PAGE_SIZE       __PAGE_SIZE
 #define PAGE_SHIFT      __PAGE_SHIFT

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

extras/mini-os/arch/x86/mm.c line 722

Quoted 5 lines · Rolf Neugebauer, le Thu 12 Mar 2009 19:43:57 +0000, a écrit :
extras/mini-os/arch/x86/mm.c +5 -0
+#define MAX_CONTIG_ORDER 9 /* 2MB */
+unsigned long alloc_contig_pages(int order, unsigned int addr_bits)
+{
+    unsigned long in_frames[1<<MAX_CONTIG_ORDER], out_frames, mfn;
+    multicall_entry_t call[(1UL << MAX_CONTIG_ORDER)];

Mmm, can't we assume we have a C99 compiler that can just use order instead of MAX_CONTIG_ORDER?

extras/mini-os/arch/x86/mm.c line 761

Quoted 3 lines
extras/mini-os/arch/x86/mm.c +3 -0
+    /* set up arguments for exchange hyper call */
+    set_xen_guest_handle(exchange.in.extent_start, in_frames);
+	set_xen_guest_handle(exchange.out.extent_start, &out_frames);

There are mixed tabs and spaces here.

Samuel