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

[Xen-devel] [PATCH 4 of 4] minios/whitespace: Clean up trailing whitespace



This patch was generated using

find . -name "*.[hcS]" | xargs sed -e "s/[         ]\+$//g" -i

from the minios directory.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/apps/daytime/daytime.c
--- a/extras/mini-os/apps/daytime/daytime.c
+++ b/extras/mini-os/apps/daytime/daytime.c
@@ -1,6 +1,6 @@
-/* 
+/*
  * daytime.c: a simple network service based on lwIP and mini-os
- * 
+ *
  * Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, July 2007
  */
 
@@ -48,7 +48,7 @@ void run_server(void *p)
 
     while (1) {
         session = netconn_accept(listener);
-        if (session == NULL) 
+        if (session == NULL)
             continue;
 
         gettimeofday(&tv, NULL);
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/arch/x86/ioremap.c
--- a/extras/mini-os/arch/x86/ioremap.c
+++ b/extras/mini-os/arch/x86/ioremap.c
@@ -1,22 +1,22 @@
 /*
  * Copyright (C) 2009,  Netronome Systems, Inc.
- *                
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -29,7 +29,7 @@
 
 /* Map a physical address range into virtual address space with provided
  * flags. Return a virtual address range it is mapped to. */
-static void *__do_ioremap(unsigned long phys_addr, unsigned long size, 
+static void *__do_ioremap(unsigned long phys_addr, unsigned long size,
                           unsigned long prot)
 {
     unsigned long va;
@@ -41,7 +41,7 @@ static void *__do_ioremap(unsigned long 
     num_pages = (offset + size + PAGE_SIZE - 1) / PAGE_SIZE;
     phys_addr &= PAGE_MASK;
     mfns = mfn = phys_addr >> PAGE_SHIFT;
-    
+
     va = (unsigned long)map_frames_ex(&mfns, num_pages, 0, 1, 1,
                                       DOMID_IO, NULL, prot);
     return (void *)(va + offset);
@@ -60,7 +60,7 @@ void *ioremap_nocache(unsigned long phys
 /* Un-map the io-remapped region. Currently no list of existing mappings is
  * maintained, so the caller has to supply the size */
 void iounmap(void *virt_addr, unsigned long size)
-{   
+{
     unsigned long num_pages;
     unsigned long va = (unsigned long)virt_addr;
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/arch/x86/mm.c
--- a/extras/mini-os/arch/x86/mm.c
+++ b/extras/mini-os/arch/x86/mm.c
@@ -1,4 +1,4 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
  * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
@@ -7,9 +7,9 @@
  *        File: mm.c
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
  *     Changes: Grzegorz Milos
- *              
+ *
  *        Date: Aug 2003, chages Aug 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: memory management related functions
  *              contains buddy page allocator from Xen.
@@ -21,16 +21,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -59,24 +59,24 @@ extern void page_walk(unsigned long va);
  * table at offset in previous level MFN (pref_l_mfn). pt_pfn is a guest
  * PFN.
  */
-static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn, 
+static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
                          unsigned long offset, unsigned long level)
-{   
+{
     pgentry_t *tab = (pgentry_t *)start_info.pt_base;
-    unsigned long pt_page = (unsigned long)pfn_to_virt(*pt_pfn); 
+    unsigned long pt_page = (unsigned long)pfn_to_virt(*pt_pfn);
     pgentry_t prot_e, prot_t;
     mmu_update_t mmu_updates[1];
     int rc;
-    
+
     prot_e = prot_t = 0;
     DEBUG("Allocating new L%d pt frame for pfn=%lx, "
-          "prev_l_mfn=%lx, offset=%lx", 
+          "prev_l_mfn=%lx, offset=%lx",
           level, *pt_pfn, prev_l_mfn, offset);
 
     /* We need to clear the page, otherwise we might fail to map it
        as a page table page */
-    memset((void*) pt_page, 0, PAGE_SIZE);  
- 
+    memset((void*) pt_page, 0, PAGE_SIZE);
+
     switch ( level )
     {
     case L1_FRAME:
@@ -105,11 +105,11 @@ static void new_pt_frame(unsigned long *
 #endif
     tab = pte_to_virt(tab[l3_table_offset(pt_page)]);
 
-    mmu_updates[0].ptr = (tab[l2_table_offset(pt_page)] & PAGE_MASK) + 
+    mmu_updates[0].ptr = (tab[l2_table_offset(pt_page)] & PAGE_MASK) +
         sizeof(pgentry_t) * l1_table_offset(pt_page);
-    mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT | 
+    mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT |
         (prot_e & ~_PAGE_RW);
-    
+
     if ( (rc = HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF)) < 0 )
     {
         printk("ERROR: PTE for new page table page could not be updated\n");
@@ -122,7 +122,7 @@ static void new_pt_frame(unsigned long *
         ((pgentry_t)prev_l_mfn << PAGE_SHIFT) + sizeof(pgentry_t) * offset;
     mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT | prot_t;
 
-    if ( (rc = HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF)) < 0 ) 
+    if ( (rc = HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF)) < 0 )
     {
         printk("ERROR: mmu_update failed with rc=%d\n", rc);
         do_exit();
@@ -150,38 +150,38 @@ static int need_pt_frame(unsigned long v
 #if defined(__x86_64__)
     if ( level == L3_FRAME )
     {
-        if ( l4_table_offset(va) >= 
+        if ( l4_table_offset(va) >=
              l4_table_offset(hyp_virt_start) &&
-             l4_table_offset(va) <= 
+             l4_table_offset(va) <=
              l4_table_offset(hyp_virt_end))
             return 0;
         return 1;
-    } 
+    }
     else
 #endif
 
     if ( level == L2_FRAME )
     {
 #if defined(__x86_64__)
-        if ( l4_table_offset(va) >= 
+        if ( l4_table_offset(va) >=
              l4_table_offset(hyp_virt_start) &&
-             l4_table_offset(va) <= 
+             l4_table_offset(va) <=
              l4_table_offset(hyp_virt_end))
 #endif
-            if ( l3_table_offset(va) >= 
+            if ( l3_table_offset(va) >=
                  l3_table_offset(hyp_virt_start) &&
-                 l3_table_offset(va) <= 
+                 l3_table_offset(va) <=
                  l3_table_offset(hyp_virt_end))
                 return 0;
 
         return 1;
-    } 
-    else 
+    }
+    else
         /* Always need l1 frames */
         if ( level == L1_FRAME )
             return 1;
 
-    printk("ERROR: Unknown frame level %d, hypervisor %llx,%llx\n", 
+    printk("ERROR: Unknown frame level %d, hypervisor %llx,%llx\n",
            level, hyp_virt_start, hyp_virt_end);
     return -1;
 }
@@ -200,7 +200,7 @@ static void build_pagetable(unsigned lon
     int count = 0;
     int rc;
 
-    pfn_to_map = 
+    pfn_to_map =
         (start_info.nr_pt_frames - NOT_L1_FRAMES) * L1_PAGETABLE_ENTRIES;
 
     if ( *max_pfn >= virt_to_pfn(HYPERVISOR_VIRT_START) )
@@ -211,7 +211,7 @@ static void build_pagetable(unsigned lon
                 (unsigned long)&_text)>>20);
         *max_pfn = virt_to_pfn(HYPERVISOR_VIRT_START - PAGE_SIZE);
         printk("%dMB\n",
-               ((unsigned long)pfn_to_virt(*max_pfn) - 
+               ((unsigned long)pfn_to_virt(*max_pfn) -
                 (unsigned long)&_text)>>20);
     }
 
@@ -230,7 +230,7 @@ static void build_pagetable(unsigned lon
         offset = l4_table_offset(start_address);
         /* Need new L3 pt frame */
         if ( !(start_address & L3_MASK) )
-            if ( need_pt_frame(start_address, L3_FRAME) ) 
+            if ( need_pt_frame(start_address, L3_FRAME) )
                 new_pt_frame(&pt_pfn, pt_mfn, offset, L3_FRAME);
 
         page = tab[offset];
@@ -246,7 +246,7 @@ static void build_pagetable(unsigned lon
         page = tab[offset];
         pt_mfn = pte_to_mfn(page);
         tab = to_virt(mfn_to_pfn(pt_mfn) << PAGE_SHIFT);
-        offset = l2_table_offset(start_address);        
+        offset = l2_table_offset(start_address);
         /* Need new L1 pt frame */
         if ( !(start_address & L1_MASK) )
             if ( need_pt_frame(start_address, L1_FRAME) )
@@ -258,7 +258,7 @@ static void build_pagetable(unsigned lon
 
         mmu_updates[count].ptr =
             ((pgentry_t)pt_mfn << PAGE_SHIFT) + sizeof(pgentry_t) * offset;
-        mmu_updates[count].val = 
+        mmu_updates[count].val =
             (pgentry_t)pfn_to_mfn(pfn_to_map++) << PAGE_SHIFT | L1_PROT;
         count++;
         if ( count == L1_PAGETABLE_ENTRIES || pfn_to_map == *max_pfn )
@@ -311,7 +311,7 @@ static void set_readonly(void *text, voi
         page = tab[offset];
         mfn = pte_to_mfn(page);
         tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
-        offset = l2_table_offset(start_address);        
+        offset = l2_table_offset(start_address);
         page = tab[offset];
         mfn = pte_to_mfn(page);
         tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
@@ -320,7 +320,7 @@ static void set_readonly(void *text, voi
 
         if ( start_address != (unsigned long)&shared_info )
         {
-            mmu_updates[count].ptr = 
+            mmu_updates[count].ptr =
                 ((pgentry_t)mfn << PAGE_SHIFT) + sizeof(pgentry_t) * offset;
             mmu_updates[count].val = tab[offset] & ~_PAGE_RW;
             count++;
@@ -330,7 +330,7 @@ static void set_readonly(void *text, voi
 
         start_address += PAGE_SIZE;
 
-        if ( count == L1_PAGETABLE_ENTRIES || 
+        if ( count == L1_PAGETABLE_ENTRIES ||
              start_address + PAGE_SIZE > end_address )
         {
             rc = HYPERVISOR_mmu_update(mmu_updates, count, NULL, DOMID_SELF);
@@ -356,16 +356,16 @@ static void set_readonly(void *text, voi
  * A useful mem testing function. Write the address to every address in the
  * range provided and read back the value. If verbose, print page walk to
  * some VA
- * 
+ *
  * If we get MEM_TEST_MAX_ERRORS we might as well stop
  */
-#define MEM_TEST_MAX_ERRORS 10 
+#define MEM_TEST_MAX_ERRORS 10
 int mem_test(unsigned long *start_va, unsigned long *end_va, int verbose)
 {
     unsigned long mask = 0x10000;
     unsigned long *pointer;
     int error_count = 0;
- 
+
     /* write values and print page walks */
     if ( verbose && (((unsigned long)start_va) & 0xfffff) )
     {
@@ -386,14 +386,14 @@ int mem_test(unsigned long *start_va, un
         printk("MemTest End: %lx\n", end_va-1);
         page_walk((unsigned long)end_va-1);
     }
- 
+
     /* verify values */
     for ( pointer = start_va; pointer < end_va; pointer++ )
     {
         if ( ((unsigned long)pointer & ~mask) != *pointer )
         {
             printk("Read error at 0x%lx. Read: 0x%lx, should read 0x%lx\n",
-                   (unsigned long)pointer, *pointer, 
+                   (unsigned long)pointer, *pointer,
                    ((unsigned long)pointer & ~mask));
             error_count++;
             if ( error_count >= MEM_TEST_MAX_ERRORS )
@@ -467,7 +467,7 @@ pgentry_t *need_pgt(unsigned long va)
     tab = mfn_to_virt(pt_mfn);
 #endif
     offset = l3_table_offset(va);
-    if ( !(tab[offset] & _PAGE_PRESENT) ) 
+    if ( !(tab[offset] & _PAGE_PRESENT) )
     {
         pt_pfn = virt_to_pfn(alloc_page());
         new_pt_frame(&pt_pfn, pt_mfn, offset, L2_FRAME);
@@ -516,7 +516,7 @@ void arch_init_demand_mapping_area(unsig
 
     demand_map_area_start = (unsigned long) pfn_to_virt(cur_pfn);
     cur_pfn += DEMAND_MAP_PAGES;
-    printk("Demand map pfns at %lx-%lx.\n", 
+    printk("Demand map pfns at %lx-%lx.\n",
            demand_map_area_start, pfn_to_virt(cur_pfn));
 
 #ifdef HAVE_LIBC
@@ -535,12 +535,12 @@ unsigned long allocate_ondemand(unsigned
 
     /* Find a properly aligned run of n contiguous frames */
     for ( x = 0;
-          x <= DEMAND_MAP_PAGES - n; 
+          x <= DEMAND_MAP_PAGES - n;
           x = (x + y + 1 + alignment - 1) & ~(alignment - 1) )
     {
         unsigned long addr = demand_map_area_start + x * PAGE_SIZE;
         pgentry_t *pgt = get_pgt(addr);
-        for ( y = 0; y < n; y++, addr += PAGE_SIZE ) 
+        for ( y = 0; y < n; y++, addr += PAGE_SIZE )
         {
             if ( !(addr & L1_MASK) )
                 pgt = get_pgt(addr);
@@ -568,8 +568,8 @@ unsigned long allocate_ondemand(unsigned
  */
 #define MAP_BATCH ((STACK_SIZE / 2) / sizeof(mmu_update_t))
 void do_map_frames(unsigned long va,
-                   const unsigned long *mfns, unsigned long n, 
-                   unsigned long stride, unsigned long incr, 
+                   const unsigned long *mfns, unsigned long n,
+                   unsigned long stride, unsigned long incr,
                    domid_t id, int *err, unsigned long prot)
 {
     pgentry_t *pgt = NULL;
@@ -577,7 +577,7 @@ void do_map_frames(unsigned long va,
     unsigned long i;
     int rc;
 
-    if ( !mfns ) 
+    if ( !mfns )
     {
         printk("do_map_frames: no mfns supplied\n");
         return;
@@ -602,11 +602,11 @@ void do_map_frames(unsigned long va,
         {
             mmu_update_t mmu_updates[todo];
 
-            for ( i = 0; i < todo; i++, va += PAGE_SIZE, pgt++) 
+            for ( i = 0; i < todo; i++, va += PAGE_SIZE, pgt++)
             {
                 if ( !pgt || !(va & L1_MASK) )
                     pgt = need_pgt(va);
-                
+
                 mmu_updates[i].ptr = virt_to_mach(pgt) | MMU_NORMAL_PT_UPDATE;
                 mmu_updates[i].val = ((pgentry_t)(mfns[(done + i) * stride] +
                                                   (done + i) * incr)
@@ -633,7 +633,7 @@ void do_map_frames(unsigned long va,
  * Map an array of MFNs contiguous into virtual address space. Virtual
  * addresses are allocated from the on demand area.
  */
-void *map_frames_ex(const unsigned long *mfns, unsigned long n, 
+void *map_frames_ex(const unsigned long *mfns, unsigned long n,
                     unsigned long stride, unsigned long incr,
                     unsigned long alignment,
                     domid_t id, int *err, unsigned long prot)
@@ -676,7 +676,7 @@ int unmap_frames(unsigned long va, unsig
             call[i].args[arg++] = 0;
 #ifdef __i386__
             call[i].args[arg++] = 0;
-#endif  
+#endif
             call[i].args[arg++] = UVMF_INVLPG;
 
             va += PAGE_SIZE;
@@ -691,7 +691,7 @@ int unmap_frames(unsigned long va, unsig
 
         for ( i = 0; i < n; i++ )
         {
-            if ( call[i].result ) 
+            if ( call[i].result )
             {
                 printk("update_va_mapping failed for with rc=%d.\n", ret);
                 return -(call[i].result);
@@ -705,12 +705,12 @@ int unmap_frames(unsigned long va, unsig
 /*
  * Allocate pages which are contiguous in machine memory.
  * Returns a VA to where they are mapped or 0 on failure.
- * 
+ *
  * addr_bits indicates if the region has restrictions on where it is
  * located. Typical values are 32 (if for example PCI devices can't access
  * 64bit memory) or 0 for no restrictions.
  *
- * Allocated pages can be freed using the page allocators free_pages() 
+ * Allocated pages can be freed using the page allocators free_pages()
  * function.
  *
  * based on Linux function xen_create_contiguous_region()
@@ -778,7 +778,7 @@ unsigned long alloc_contig_pages(int ord
         call[i].args[arg++] = 0;
 #ifdef __i386__
         call[i].args[arg++] = 0;
-#endif  
+#endif
         call[i].args[arg++] = UVMF_INVLPG;
     }
 
@@ -793,10 +793,10 @@ unsigned long alloc_contig_pages(int ord
     out_frames = virt_to_pfn(in_va); /* PFNs to populate */
     ret = HYPERVISOR_memory_op(XENMEM_exchange, &exchange);
     if ( ret ) {
-        printk("mem exchanged order=0x%x failed with rc=%d, 
nr_exchanged=%d\n", 
+        printk("mem exchanged order=0x%x failed with rc=%d, nr_exchanged=%d\n",
                order, ret, exchange.nr_exchanged);
         /* we still need to return the allocated pages above to the pool
-         * ie. map them back into the 1:1 mapping etc. so we continue but 
+         * ie. map them back into the 1:1 mapping etc. so we continue but
          * in the end return the pages to the page allocator and return 0. */
         exch_success = 0;
     }
@@ -824,7 +824,7 @@ unsigned long alloc_contig_pages(int ord
 #else
         call[i].args[arg++] = pte.pte_low;
         call[i].args[arg++] = pte.pte_high;
-#endif  
+#endif
         call[i].args[arg++] = UVMF_INVLPG;
     }
     ret = HYPERVISOR_multicall(call, i);
@@ -840,7 +840,7 @@ unsigned long alloc_contig_pages(int ord
         free_pages((void *) in_va, order);
         return 0;
     }
-    
+
     return in_va;
 }
 
@@ -863,24 +863,24 @@ void arch_init_p2m(unsigned long max_pfn
 {
 #ifdef __x86_64__
 #define L1_P2M_SHIFT    9
-#define L2_P2M_SHIFT    18    
-#define L3_P2M_SHIFT    27    
+#define L2_P2M_SHIFT    18
+#define L3_P2M_SHIFT    27
 #else
 #define L1_P2M_SHIFT    10
-#define L2_P2M_SHIFT    20    
-#define L3_P2M_SHIFT    30    
+#define L2_P2M_SHIFT    20
+#define L3_P2M_SHIFT    30
 #endif
-#define L1_P2M_ENTRIES  (1 << L1_P2M_SHIFT)    
-#define L2_P2M_ENTRIES  (1 << (L2_P2M_SHIFT - L1_P2M_SHIFT))    
-#define L3_P2M_ENTRIES  (1 << (L3_P2M_SHIFT - L2_P2M_SHIFT))    
-#define L1_P2M_MASK     (L1_P2M_ENTRIES - 1)    
-#define L2_P2M_MASK     (L2_P2M_ENTRIES - 1)    
-#define L3_P2M_MASK     (L3_P2M_ENTRIES - 1)    
-    
+#define L1_P2M_ENTRIES  (1 << L1_P2M_SHIFT)
+#define L2_P2M_ENTRIES  (1 << (L2_P2M_SHIFT - L1_P2M_SHIFT))
+#define L3_P2M_ENTRIES  (1 << (L3_P2M_SHIFT - L2_P2M_SHIFT))
+#define L1_P2M_MASK     (L1_P2M_ENTRIES - 1)
+#define L2_P2M_MASK     (L2_P2M_ENTRIES - 1)
+#define L3_P2M_MASK     (L3_P2M_ENTRIES - 1)
+
     unsigned long *l1_list = NULL, *l2_list = NULL, *l3_list;
     unsigned long pfn;
-    
-    l3_list = (unsigned long *)alloc_page(); 
+
+    l3_list = (unsigned long *)alloc_page();
     for ( pfn=0; pfn<max_pfn; pfn++ )
     {
         if ( !(pfn % (L1_P2M_ENTRIES * L2_P2M_ENTRIES)) )
@@ -891,18 +891,18 @@ void arch_init_p2m(unsigned long max_pfn
                 printk("Error: Too many pfns.\n");
                 do_exit();
             }
-            l3_list[(pfn >> L2_P2M_SHIFT)] = virt_to_mfn(l2_list);  
+            l3_list[(pfn >> L2_P2M_SHIFT)] = virt_to_mfn(l2_list);
         }
         if ( !(pfn % (L1_P2M_ENTRIES)) )
         {
             l1_list = (unsigned long*)alloc_page();
-            l2_list[(pfn >> L1_P2M_SHIFT) & L2_P2M_MASK] = 
-                virt_to_mfn(l1_list); 
+            l2_list[(pfn >> L1_P2M_SHIFT) & L2_P2M_MASK] =
+                virt_to_mfn(l1_list);
         }
 
-        l1_list[pfn & L1_P2M_MASK] = pfn_to_mfn(pfn); 
+        l1_list[pfn & L1_P2M_MASK] = pfn_to_mfn(pfn);
     }
-    HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = 
+    HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
         virt_to_mfn(l3_list);
     HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
 }
@@ -919,7 +919,7 @@ void arch_init_mm(unsigned long* start_p
     printk("       _end: %p(VA)\n", &_end);
 
     /* First page follows page table pages and 3 more pages (store page etc) */
-    start_pfn = PFN_UP(to_phys(start_info.pt_base)) + 
+    start_pfn = PFN_UP(to_phys(start_info.pt_base)) +
         start_info.nr_pt_frames + 3;
     max_pfn = start_info.nr_pages;
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/arch/x86/sched.c
--- a/extras/mini-os/arch/x86/sched.c
+++ b/extras/mini-os/arch/x86/sched.c
@@ -1,4 +1,4 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
  ****************************************************************************
@@ -6,13 +6,13 @@
  *        File: sched.c
  *      Author: Grzegorz Milos
  *     Changes: Robert Kaiser
- *              
+ *
  *        Date: Aug 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: simple scheduler for Mini-Os
  *
- * The scheduler is non-preemptive (cooperative), and schedules according 
+ * The scheduler is non-preemptive (cooperative), and schedules according
  * to Round Robin algorithm.
  *
  ****************************************************************************
@@ -22,16 +22,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -57,12 +57,12 @@
 
 void dump_stack(struct thread *thread)
 {
-    unsigned long *bottom = (unsigned long *)(thread->stack + STACK_SIZE); 
+    unsigned long *bottom = (unsigned long *)(thread->stack + STACK_SIZE);
     unsigned long *pointer = (unsigned long *)thread->sp;
     int count;
     if(thread == current)
     {
-#ifdef __i386__    
+#ifdef __i386__
         asm("movl %%esp,%0"
             : "=r"(pointer));
 #else
@@ -76,11 +76,11 @@ void dump_stack(struct thread *thread)
         printk("[0x%lx] 0x%lx\n", pointer, *pointer);
         pointer++;
     }
-    
+
     if(pointer < bottom) printk(" ... continues.\n");
 }
 
-/* Gets run when a new thread is scheduled the first time ever, 
+/* Gets run when a new thread is scheduled the first time ever,
    defined in x86_[32/64].S */
 extern void thread_starter(void);
 
@@ -96,18 +96,18 @@ struct thread* arch_create_thread(char *
                                   void *data)
 {
     struct thread *thread;
-    
+
     thread = xmalloc(struct thread);
     /* We can't use lazy allocation here since the trap handler runs on the 
stack */
     thread->stack = (char *)alloc_pages(STACK_SIZE_PAGE_ORDER);
     thread->name = name;
-    printk("Thread \"%s\": pointer: 0x%lx, stack: 0x%lx\n", name, thread, 
+    printk("Thread \"%s\": pointer: 0x%lx, stack: 0x%lx\n", name, thread,
             thread->stack);
-    
+
     thread->sp = (unsigned long)thread->stack + STACK_SIZE;
     /* Save pointer to the thread on the stack, used by current macro */
     *((unsigned long *)thread->stack) = (unsigned long)thread;
-    
+
     stack_push(thread, (unsigned long) function);
     stack_push(thread, (unsigned long) data);
     thread->ip = (unsigned long) thread_starter;
@@ -116,19 +116,19 @@ struct thread* arch_create_thread(char *
 
 void run_idle_thread(void)
 {
-    /* Switch stacks and run the thread */ 
+    /* Switch stacks and run the thread */
 #if defined(__i386__)
     __asm__ __volatile__("mov %0,%%esp\n\t"
-                         "push %1\n\t" 
-                         "ret"                                            
+                         "push %1\n\t"
+                         "ret"
                          :"=m" (idle_thread->sp)
-                         :"m" (idle_thread->ip));                          
+                         :"m" (idle_thread->ip));
 #elif defined(__x86_64__)
     __asm__ __volatile__("mov %0,%%rsp\n\t"
-                         "push %1\n\t" 
-                         "ret"                                            
+                         "push %1\n\t"
+                         "ret"
                          :"=m" (idle_thread->sp)
-                         :"m" (idle_thread->ip));                              
                      
+                         :"m" (idle_thread->ip));
 #endif
 }
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/arch/x86/setup.c
--- a/extras/mini-os/arch/x86/setup.c
+++ b/extras/mini-os/arch/x86/setup.c
@@ -1,27 +1,27 @@
 /******************************************************************************
  * common.c
- * 
+ *
  * Common stuff special to x86 goes here.
- * 
+ *
  * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
  * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  *
  */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/arch/x86/time.c
--- a/extras/mini-os/arch/x86/time.c
+++ b/extras/mini-os/arch/x86/time.c
@@ -1,7 +1,7 @@
 /* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
  ****************************************************************************
  * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
- * (C) 2002-2003 - Keir Fraser - University of Cambridge 
+ * (C) 2002-2003 - Keir Fraser - University of Cambridge
  * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
  * (C) 2006 - Robert Kaiser - FH Wiesbaden
  ****************************************************************************
@@ -18,16 +18,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -74,7 +74,7 @@ static struct shadow_time_info shadow;
 
 static inline int time_values_up_to_date(void)
 {
-       struct vcpu_time_info *src = 
&HYPERVISOR_shared_info->vcpu_info[0].time; 
+       struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0].time;
 
        return (shadow.version == src->version);
 }
@@ -187,8 +187,8 @@ int gettimeofday(struct timeval *tv, voi
 {
     uint64_t nsec = monotonic_clock();
     nsec += shadow_ts.tv_nsec;
-    
-    
+
+
     tv->tv_sec = shadow_ts.tv_sec;
     tv->tv_sec += NSEC_TO_SEC(nsec);
     tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL);
@@ -212,7 +212,7 @@ void block_domain(s_time_t until)
 
 
 /*
- * Just a dummy 
+ * Just a dummy
  */
 static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
 {
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/arch/x86/traps.c
--- a/extras/mini-os/arch/x86/traps.c
+++ b/extras/mini-os/arch/x86/traps.c
@@ -33,7 +33,7 @@ void machine_check(void);
 void dump_regs(struct pt_regs *regs)
 {
     printk("Thread: %s\n", current->name);
-#ifdef __i386__    
+#ifdef __i386__
     printk("EIP: %x, EFLAGS %x.\n", regs->eip, regs->eflags);
     printk("EBX: %08x ECX: %08x EDX: %08x\n",
           regs->ebx, regs->ecx, regs->edx);
@@ -45,18 +45,18 @@ void dump_regs(struct pt_regs *regs)
           regs->xcs, regs->eflags, regs->esp, regs->xss);
 #else
     printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
-    printk("\nRSP: %04lx:%016lx  EFLAGS: %08lx\n", 
+    printk("\nRSP: %04lx:%016lx  EFLAGS: %08lx\n",
            regs->ss, regs->rsp, regs->eflags);
     printk("RAX: %016lx RBX: %016lx RCX: %016lx\n",
            regs->rax, regs->rbx, regs->rcx);
     printk("RDX: %016lx RSI: %016lx RDI: %016lx\n",
-           regs->rdx, regs->rsi, regs->rdi); 
+           regs->rdx, regs->rsi, regs->rdi);
     printk("RBP: %016lx R08: %016lx R09: %016lx\n",
-           regs->rbp, regs->r8, regs->r9); 
+           regs->rbp, regs->r8, regs->r9);
     printk("R10: %016lx R11: %016lx R12: %016lx\n",
-           regs->r10, regs->r11, regs->r12); 
+           regs->r10, regs->r11, regs->r12);
     printk("R13: %016lx R14: %016lx R15: %016lx\n",
-           regs->r13, regs->r14, regs->r15); 
+           regs->r13, regs->r14, regs->r15);
 #endif
 }
 
@@ -98,7 +98,7 @@ void page_walk(unsigned long virt_addres
         pgentry_t *tab = (pgentry_t *)start_info.pt_base, page;
         unsigned long addr = virt_address;
         printk("Pagetable walk from virt %lx, base %lx:\n", virt_address, 
start_info.pt_base);
-    
+
 #if defined(__x86_64__)
         page = tab[l4_table_offset(addr)];
         tab = pte_to_virt(page);
@@ -110,7 +110,7 @@ void page_walk(unsigned long virt_addres
         page = tab[l2_table_offset(addr)];
         tab = pte_to_virt(page);
         printk("   L2 = %"PRIpte" (%p)  [offset = %lx]\n", page, tab, 
l2_table_offset(addr));
-        
+
         page = tab[l1_table_offset(addr)];
         printk("    L1 = %"PRIpte" [offset = %lx]\n", page, 
l1_table_offset(addr));
 
@@ -136,7 +136,7 @@ static int handle_cow(unsigned long addr
        if (!(page & _PAGE_PRESENT))
            return 0;
         tab = pte_to_virt(page);
-        
+
         page = tab[l1_table_offset(addr)];
        if (!(page & _PAGE_PRESENT))
            return 0;
@@ -204,10 +204,10 @@ void do_page_fault(struct pt_regs *regs,
 
     /* If we are already handling a page fault, and got another one
        that means we faulted in pagetable walk. Continuing here would cause
-       a recursive fault */       
-    if(handling_pg_fault == 1) 
+       a recursive fault */
+    if(handling_pg_fault == 1)
     {
-        printk("Page fault in pagetable walk (access to invalid memory?).\n"); 
+        printk("Page fault in pagetable walk (access to invalid memory?).\n");
         HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
     }
     handling_pg_fault++;
@@ -244,7 +244,7 @@ void do_general_protection(struct pt_reg
     struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_crash };
 #ifdef __i386__
     printk("GPF eip: %p, error_code=%lx\n", regs->eip, error_code);
-#else    
+#else
     printk("GPF rip: %p, error_code=%lx\n", regs->rip, error_code);
 #endif
     dump_regs(regs);
@@ -319,12 +319,12 @@ static trap_info_t trap_table[] = {
     { 19, 0, __KERNEL_CS, (unsigned long)simd_coprocessor_error      },
     {  0, 0,           0, 0                           }
 };
-    
+
 
 
 void trap_init(void)
 {
-    HYPERVISOR_set_trap_table(trap_table);    
+    HYPERVISOR_set_trap_table(trap_table);
 }
 
 void trap_fini(void)
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/arch/x86/x86_32.S
--- a/extras/mini-os/arch/x86/x86_32.S
+++ b/extras/mini-os/arch/x86/x86_32.S
@@ -14,12 +14,12 @@
 .text
 
 .globl _start, shared_info, hypercall_page
-                        
+
 _start:
         cld
         lss stack_start,%esp
         andl $(~(__STACK_SIZE-1)), %esp
-        push %esi 
+        push %esi
         call start_kernel
 
 stack_start:
@@ -67,7 +67,7 @@ CS            = 0x2C
        popl %ds;       \
        popl %es;       \
        addl $4,%esp;   \
-       iret;           
+       iret;
 
 ENTRY(divide_error)
        pushl $0                # no error code
@@ -97,7 +97,7 @@ do_exception:
     pushl %eax
        call *%edi
     jmp ret_from_exception
-    
+
 ret_from_exception:
     movb CS(%esp),%cl
     addl $8,%esp
@@ -145,7 +145,7 @@ ecrit:  /**** END OF CRITICAL REGION ***
 # registers are in each frame. We do this quickly using the lookup table
 # 'critical_fixup_table'. For each byte offset in the critical region, it
 # provides the number of bytes which have already been popped from the
-# interrupted stack frame. 
+# interrupted stack frame.
 critical_region_fixup:
         addl $critical_fixup_table-scrit,%eax
         movzbl (%eax),%eax    # %eax contains num bytes popped
@@ -163,8 +163,8 @@ 15:     subl $4,%esi          # pre-decr
         loop 15b
 16:     movl %edi,%esp        # final %edi is top of merged stack
         jmp  11b
-         
-critical_fixup_table:        
+
+critical_fixup_table:
         .byte 0x00,0x00,0x00                  # testb $0xff,(%esi)
         .byte 0x00,0x00                       # jne  14f
         .byte 0x00                            # pop  %ebx
@@ -180,7 +180,7 @@ critical_fixup_table:
         .byte 0x28                            # iret
         .byte 0x00,0x00,0x00,0x00             # movb $1,1(%esi)
         .byte 0x00,0x00                       # jmp  11b
-       
+
 # Hypervisor uses this for application faults while it executes.
 ENTRY(failsafe_callback)
       pop  %ds
@@ -188,7 +188,7 @@ ENTRY(failsafe_callback)
       pop  %fs
       pop  %gs
       iret
-                
+
 ENTRY(coprocessor_error)
        pushl $0
        pushl $do_coprocessor_error
@@ -262,7 +262,7 @@ ENTRY(alignment_check)
 ENTRY(page_fault)
     pushl $do_page_fault
     jmp do_exception
-    
+
 ENTRY(machine_check)
        pushl $0
        pushl $do_machine_check
@@ -283,8 +283,8 @@ ENTRY(thread_starter)
     xorl %ebp,%ebp
     pushl %eax
     call *%ebx
-    call exit_thread 
-    
+    call exit_thread
+
 ENTRY(__arch_switch_threads)
     movl 4(%esp), %ecx         /* prev */
     movl 8(%esp), %edx         /* next */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/arch/x86/x86_64.S
--- a/extras/mini-os/arch/x86/x86_64.S
+++ b/extras/mini-os/arch/x86/x86_64.S
@@ -36,14 +36,14 @@ hypercall_page:
         .org 0x3000
 
 
-/* Offsets into shared_info_t. */                
+/* Offsets into shared_info_t. */
 #define evtchn_upcall_pending          /* 0 */
 #define evtchn_upcall_mask             1
 
 NMI_MASK = 0x80000000
 
 #define RDI 112
-#define ORIG_RAX 120       /* + error_code */ 
+#define ORIG_RAX 120       /* + error_code */
 #define EFLAGS 144
 
 .macro RESTORE_ALL
@@ -57,7 +57,7 @@ NMI_MASK = 0x80000000
        movq 7*8(%rsp),%rsi
        movq 8*8(%rsp),%rdi
        addq $9*8+8,%rsp
-.endm  
+.endm
 
 
 .macro HYPERVISOR_IRET flag
@@ -80,32 +80,32 @@ 2:  /* Slow iret via hypervisor. */
 
 /*
  * Exception entry point. This expects an error code/orig_rax on the stack
- * and the exception handler in %rax.  
- */                                            
+ * and the exception handler in %rax.
+ */
 ENTRY(error_entry)
        /* rdi slot contains rax, oldrax contains error code */
-       cld     
+       cld
        subq  $14*8,%rsp
        movq %rsi,13*8(%rsp)
        movq 14*8(%rsp),%rsi    /* load rax from rdi slot */
        movq %rdx,12*8(%rsp)
        movq %rcx,11*8(%rsp)
-       movq %rsi,10*8(%rsp)    /* store rax */ 
+       movq %rsi,10*8(%rsp)    /* store rax */
        movq %r8, 9*8(%rsp)
        movq %r9, 8*8(%rsp)
        movq %r10,7*8(%rsp)
        movq %r11,6*8(%rsp)
-       movq %rbx,5*8(%rsp) 
-       movq %rbp,4*8(%rsp) 
-       movq %r12,3*8(%rsp) 
-       movq %r13,2*8(%rsp) 
-       movq %r14,1*8(%rsp) 
-       movq %r15,(%rsp) 
+       movq %rbx,5*8(%rsp)
+       movq %rbp,4*8(%rsp)
+       movq %r12,3*8(%rsp)
+       movq %r13,2*8(%rsp)
+       movq %r14,1*8(%rsp)
+       movq %r15,(%rsp)
 
 error_call_handler:
-       movq %rdi, RDI(%rsp)            
+       movq %rdi, RDI(%rsp)
        movq %rsp,%rdi
-       movq ORIG_RAX(%rsp),%rsi        # get error code 
+       movq ORIG_RAX(%rsp),%rsi        # get error code
        movq $-1,ORIG_RAX(%rsp)
        call *%rax
        jmp error_exit
@@ -114,11 +114,11 @@ error_call_handler:
     movq (%rsp),%rcx
     movq 8(%rsp),%r11
     addq $0x10,%rsp /* skip rcx and r11 */
-       pushq $0        /* push error code/oldrax */ 
-       pushq %rax      /* push real oldrax to the rdi slot */ 
+       pushq $0        /* push error code/oldrax */
+       pushq %rax      /* push real oldrax to the rdi slot */
        leaq  \sym(%rip),%rax
        jmp error_entry
-.endm  
+.endm
 
 .macro errorentry sym
         movq (%rsp),%rcx
@@ -150,17 +150,17 @@ ENTRY(hypervisor_callback)
     zeroentry hypervisor_callback2
 
 ENTRY(hypervisor_callback2)
-        movq %rdi, %rsp 
+        movq %rdi, %rsp
 11:     movq %gs:8,%rax
         incl %gs:0
         cmovzq %rax,%rsp
         pushq %rdi
-        call do_hypervisor_callback 
+        call do_hypervisor_callback
         popq %rsp
         decl %gs:0
         jmp error_exit
 
-restore_all_enable_events:  
+restore_all_enable_events:
        XEN_UNBLOCK_EVENTS(%rsi)        # %rsi is already set up...
 
 scrit: /**** START OF CRITICAL REGION ****/
@@ -169,16 +169,16 @@ scrit:    /**** START OF CRITICAL REGION **
        XEN_PUT_VCPU_INFO(%rsi)
         RESTORE_ALL
         HYPERVISOR_IRET 0
-        
+
 14:    XEN_LOCKED_BLOCK_EVENTS(%rsi)
        XEN_PUT_VCPU_INFO(%rsi)
        subq $6*8,%rsp
-       movq %rbx,5*8(%rsp) 
-       movq %rbp,4*8(%rsp) 
-       movq %r12,3*8(%rsp) 
-       movq %r13,2*8(%rsp) 
-       movq %r14,1*8(%rsp) 
-       movq %r15,(%rsp) 
+       movq %rbx,5*8(%rsp)
+       movq %rbp,4*8(%rsp)
+       movq %r12,3*8(%rsp)
+       movq %r13,2*8(%rsp)
+       movq %r14,1*8(%rsp)
+       movq %r15,(%rsp)
         movq %rsp,%rdi                  # set the argument again
        jmp  11b
 ecrit:  /**** END OF CRITICAL REGION ****/
@@ -193,12 +193,12 @@ retint_restore_args:
        andb $1,%al                     # EAX[0] == IRET_EFLAGS.IF & event_mask
        jnz restore_all_enable_events   #        != 0 => enable event delivery
        XEN_PUT_VCPU_INFO(%rsi)
-               
+
        RESTORE_ALL
        HYPERVISOR_IRET 0
 
 
-error_exit:            
+error_exit:
        movq (%rsp),%r15
        movq 1*8(%rsp),%r14
        movq 2*8(%rsp),%r13
@@ -206,7 +206,7 @@ error_exit:
        movq 4*8(%rsp),%rbp
        movq 5*8(%rsp),%rbx
        addq $6*8,%rsp
-       XEN_BLOCK_EVENTS(%rsi)          
+       XEN_BLOCK_EVENTS(%rsi)
        jmp retint_kernel
 
 
@@ -242,8 +242,8 @@ ENTRY(overflow)
 
 ENTRY(bounds)
         zeroentry do_bounds
-    
-    
+
+
 ENTRY(invalid_op)
         zeroentry do_invalid_op
 
@@ -263,7 +263,7 @@ ENTRY(segment_not_present)
 /* runs on exception stack */
 ENTRY(stack_segment)
         errorentry do_stack_segment
-                    
+
 
 ENTRY(general_protection)
         errorentry do_general_protection
@@ -279,7 +279,7 @@ ENTRY(divide_error)
 
 ENTRY(spurious_interrupt_bug)
         zeroentry do_spurious_interrupt_bug
-            
+
 
 ENTRY(page_fault)
         errorentry do_page_fault
@@ -294,8 +294,8 @@ ENTRY(thread_starter)
         pushq $0
         xorq %rbp,%rbp
         call *%rbx
-        call exit_thread 
-        
+        call exit_thread
+
 
 ENTRY(__arch_switch_threads)
        pushq %rbp
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c
+++ b/extras/mini-os/blkfront.c
@@ -1,4 +1,4 @@
-/* Minimal block driver for Mini-OS. 
+/* Minimal block driver for Mini-OS.
  * Copyright (c) 2007-2008 Samuel Thibault.
  * Based on netfront.c.
  */
@@ -111,7 +111,7 @@ struct blkfront_dev *init_blkfront(char 
 #endif
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    dev->dom = xenbus_read_integer(path); 
+    dev->dom = xenbus_read_integer(path);
     evtchn_alloc_unbound(dev->dom, blkfront_handler, dev, &dev->evtchn);
 
     s = (struct blkif_sring*) alloc_page();
@@ -587,7 +587,7 @@ int blkfront_posix_rwop(int fd, uint8_t*
    /* Write mode checks */
    if(write) {
       /*Make sure we have write permission */
-      if(dev->info.info & VDISK_READONLY 
+      if(dev->info.info & VDISK_READONLY
             || (dev->info.mode != O_RDWR  && dev->info.mode !=  O_WRONLY)) {
          errno = EACCES;
          return -1;
@@ -651,7 +651,7 @@ int blkfront_posix_rwop(int fd, uint8_t*
          }
 
          /* For an aligned R/W we can read up to the maximum transfer size */
-         bytes = count > 
(BLKIF_MAX_SEGMENTS_PER_REQUEST-not_page_aligned)*PAGE_SIZE 
+         bytes = count > 
(BLKIF_MAX_SEGMENTS_PER_REQUEST-not_page_aligned)*PAGE_SIZE
             ? (BLKIF_MAX_SEGMENTS_PER_REQUEST-not_page_aligned)*PAGE_SIZE
             : count & ~(blocksize -1);
          aiocb.aio_nbytes = bytes;
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/console/console.c
--- a/extras/mini-os/console/console.c
+++ b/extras/mini-os/console/console.c
@@ -1,14 +1,14 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2006 - Grzegorz Milos - Cambridge University
  ****************************************************************************
  *
  *        File: console.h
  *      Author: Grzegorz Milos
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: Mar 2006
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Console interface.
  *
@@ -21,19 +21,19 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
- 
+
 #include <mini-os/types.h>
 #include <mini-os/wait.h>
 #include <mini-os/mm.h>
@@ -50,7 +50,7 @@
 #define USE_XEN_CONSOLE
 
 
-/* If console not initialised the printk will be sent to xen serial line 
+/* If console not initialised the printk will be sent to xen serial line
    NOTE: you need to enable verbose in xen/Rules.mk for it to work. */
 static int console_initialised = 0;
 
@@ -61,7 +61,7 @@ static int console_initialised = 0;
         /* Just repeat what's written */
         buf[len] = '\0';
         printk("%s", buf);
-        
+
         if(buf[len-1] == '\r')
             printk("\nNo console input handler.\n");
     }
@@ -115,16 +115,16 @@ void console_print(struct consfront_dev 
         copied_ptr[length] = '\n';
         length++;
     }
-    
+
     ring_send_fn(dev, copied_ptr, length);
 }
 
 void print(int direct, const char *fmt, va_list args)
 {
     static char   buf[1024];
-    
+
     (void)vsnprintf(buf, sizeof(buf), fmt, args);
- 
+
     if(direct)
     {
         (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
@@ -132,9 +132,9 @@ void print(int direct, const char *fmt, 
     } else {
 #ifndef USE_XEN_CONSOLE
     if(!console_initialised)
-#endif    
+#endif
             (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
-        
+
         console_print(NULL, buf, strlen(buf));
     }
 }
@@ -144,7 +144,7 @@ void printk(const char *fmt, ...)
     va_list       args;
     va_start(args, fmt);
     print(0, fmt, args);
-    va_end(args);        
+    va_end(args);
 }
 
 void xprintk(const char *fmt, ...)
@@ -152,12 +152,12 @@ void xprintk(const char *fmt, ...)
     va_list       args;
     va_start(args, fmt);
     print(1, fmt, args);
-    va_end(args);        
+    va_end(args);
 }
 void init_console(void)
-{   
+{
     printk("Initialising console ... ");
-    xencons_ring_init();    
+    xencons_ring_init();
     console_initialised = 1;
     /* This is also required to notify the daemon */
     printk("done.\n");
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/console/xenbus.c
--- a/extras/mini-os/console/xenbus.c
+++ b/extras/mini-os/console/xenbus.c
@@ -84,7 +84,7 @@ struct consfront_dev *init_consfront(cha
 #endif
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    if ((res = xenbus_read_integer(path)) < 0) 
+    if ((res = xenbus_read_integer(path)) < 0)
         return NULL;
     else
         dev->dom = res;
@@ -166,7 +166,7 @@ done:
         XenbusState state;
         char path[strlen(dev->backend) + 1 + 19 + 1];
         snprintf(path, sizeof(path), "%s/state", dev->backend);
-        
+
        xenbus_watch_path_token(XBT_NIL, path, path, &dev->events);
         msg = NULL;
         state = xenbus_read_integer(path);
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c
+++ b/extras/mini-os/console/xencons_ring.c
@@ -30,10 +30,10 @@ static inline struct xencons_interface *
         return mfn_to_virt(start_info.console.domU.mfn);
     else
         return NULL;
-} 
- 
+}
+
 int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, 
unsigned len)
-{      
+{
     int sent = 0;
        struct xencons_interface *intf;
        XENCONS_RING_IDX cons, prod;
@@ -55,7 +55,7 @@ int xencons_ring_send_no_notify(struct c
 
        wmb();
        intf->out_prod = prod;
-    
+
     return sent;
 }
 
@@ -67,7 +67,7 @@ int xencons_ring_send(struct consfront_d
     notify_daemon(dev);
 
     return sent;
-}      
+}
 
 
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/events.c
--- a/extras/mini-os/events.c
+++ b/extras/mini-os/events.c
@@ -7,9 +7,9 @@
  *        File: events.c
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
  *     Changes: Grzegorz Milos (gm281@xxxxxxxxx)
- *              
+ *
  *        Date: Jul 2003, changes Jun 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Deals with events recieved on event channels
  *
@@ -125,7 +125,7 @@ void unbind_evtchn(evtchn_port_t port )
        rc = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
     if ( rc )
         printk("WARN: close_port %s failed rc=%d. ignored\n", port, rc);
-        
+
 }
 
 evtchn_port_t bind_virq(uint32_t virq, evtchn_handler_t handler, void *data)
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c
+++ b/extras/mini-os/fbfront.c
@@ -1,5 +1,5 @@
 /*
- * Frame Buffer + Keyboard driver for Mini-OS. 
+ * Frame Buffer + Keyboard driver for Mini-OS.
  * Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, 2008
  * Based on blkfront.c.
  */
@@ -87,7 +87,7 @@ struct kbdfront_dev *init_kbdfront(char 
 #endif
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    dev->dom = xenbus_read_integer(path); 
+    dev->dom = xenbus_read_integer(path);
     evtchn_alloc_unbound(dev->dom, kbdfront_handler, dev, &dev->evtchn);
 
     dev->page = s = (struct xenkbd_page*) alloc_page();
@@ -425,7 +425,7 @@ struct fbfront_dev *init_fbfront(char *_
 #endif
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    dev->dom = xenbus_read_integer(path); 
+    dev->dom = xenbus_read_integer(path);
     evtchn_alloc_unbound(dev->dom, fbfront_handler, dev, &dev->evtchn);
 
     dev->page = s = (struct xenfb_page*) alloc_page();
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/gntmap.c
--- a/extras/mini-os/gntmap.c
+++ b/extras/mini-os/gntmap.c
@@ -21,12 +21,12 @@
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -100,7 +100,7 @@ gntmap_set_max_grants(struct gntmap *map
 }
 
 static int
-_gntmap_map_grant_ref(struct gntmap_entry *entry, 
+_gntmap_map_grant_ref(struct gntmap_entry *entry,
                       unsigned long host_addr,
                       uint32_t domid,
                       uint32_t ref,
@@ -178,7 +178,7 @@ gntmap_munmap(struct gntmap *map, unsign
 }
 
 void*
-gntmap_map_grant_refs(struct gntmap *map, 
+gntmap_map_grant_refs(struct gntmap *map,
                       uint32_t count,
                       uint32_t *domids,
                       int domids_stride,
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/gnttab.c
--- a/extras/mini-os/gnttab.c
+++ b/extras/mini-os/gnttab.c
@@ -1,14 +1,14 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2006 - Cambridge University
  ****************************************************************************
  *
  *        File: gnttab.c
- *      Author: Steven Smith (sos22@xxxxxxxxx) 
+ *      Author: Steven Smith (sos22@xxxxxxxxx)
  *     Changes: Grzegorz Milos (gm281@xxxxxxxxx)
- *              
+ *
  *        Date: July 2006
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Simple grant tables implementation. About as stupid as it's
  *  possible to be and still work.
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/hypervisor.c
--- a/extras/mini-os/hypervisor.c
+++ b/extras/mini-os/hypervisor.c
@@ -1,27 +1,27 @@
 /******************************************************************************
  * hypervisor.c
- * 
+ *
  * Communication to/from hypervisor.
- * 
+ *
  * Copyright (c) 2002-2003, K A Fraser
  * Copyright (c) 2005, Grzegorz Milos, gm281@xxxxxxxxx,Intel Research Cambridge
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -45,7 +45,7 @@ void do_hypervisor_callback(struct pt_re
     vcpu_info_t   *vcpu_info = &s->vcpu_info[cpu];
 
     in_callback = 1;
-   
+
     vcpu_info->evtchn_upcall_pending = 0;
     /* NB x86. No need for a barrier here -- XCHG is a barrier on x86. */
 #if !defined(__i386__) && !defined(__x86_64__)
@@ -57,7 +57,7 @@ void do_hypervisor_callback(struct pt_re
     {
         l1i = __ffs(l1);
         l1 &= ~(1UL << l1i);
-        
+
         while ( (l2 = active_evtchns(cpu, s, l1i)) != 0 )
         {
             l2i = __ffs(l2);
@@ -105,7 +105,7 @@ inline void unmask_evtchn(uint32_t port)
      * The following is basically the equivalent of 'hw_resend_irq'. Just like
      * a real IO-APIC we 'lose the interrupt edge' if the channel is masked.
      */
-    if (  synch_test_bit        (port,    &s->evtchn_pending[0]) && 
+    if (  synch_test_bit        (port,    &s->evtchn_pending[0]) &&
          !synch_test_and_set_bit(port / (sizeof(unsigned long) * 8),
               &vcpu_info->evtchn_pending_sel) )
     {
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/arch/cc.h
--- a/extras/mini-os/include/arch/cc.h
+++ b/extras/mini-os/include/arch/cc.h
@@ -1,7 +1,7 @@
-/* 
+/*
  * lwip/arch/cc.h
  *
- * Compiler-specific types and macros for lwIP running on mini-os 
+ * Compiler-specific types and macros for lwIP running on mini-os
  *
  * Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, July 2007
  */
@@ -28,7 +28,7 @@ typedef uint16_t u_short;
 /*   Compiler hints for packing lwip's structures - */
 #define PACK_STRUCT_FIELD(_x)  _x
 #define PACK_STRUCT_STRUCT     __attribute__ ((packed))
-#define PACK_STRUCT_BEGIN 
+#define PACK_STRUCT_BEGIN
 #define PACK_STRUCT_END
 
 /*   Platform specific diagnostic output - */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/arch/perf.h
--- a/extras/mini-os/include/arch/perf.h
+++ b/extras/mini-os/include/arch/perf.h
@@ -1,7 +1,7 @@
-/* 
+/*
  * lwip/arch/perf.h
  *
- * Arch-specific performance measurement for lwIP running on mini-os 
+ * Arch-specific performance measurement for lwIP running on mini-os
  *
  * Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, July 2007
  */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/arch/sys_arch.h
--- a/extras/mini-os/include/arch/sys_arch.h
+++ b/extras/mini-os/include/arch/sys_arch.h
@@ -1,7 +1,7 @@
-/* 
+/*
  * lwip/arch/sys_arch.h
  *
- * Arch-specific semaphores and mailboxes for lwIP running on mini-os 
+ * Arch-specific semaphores and mailboxes for lwIP running on mini-os
  *
  * Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, July 2007
  */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/console.h
--- a/extras/mini-os/include/console.h
+++ b/extras/mini-os/include/console.h
@@ -1,14 +1,14 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2006 - Grzegorz Milos - Cambridge University
  ****************************************************************************
  *
  *        File: console.h
  *      Author: Grzegorz Milos
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: Mar 2006
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Console interface.
  *
@@ -21,16 +21,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 #ifndef _LIB_CONSOLE_H_
@@ -67,7 +67,7 @@ void print(int direct, const char *fmt, 
 void printk(const char *fmt, ...);
 void xprintk(const char *fmt, ...);
 
-#define tprintk(_fmt, _args...) printk("[%s] " _fmt, current->name, ##_args) 
+#define tprintk(_fmt, _args...) printk("[%s] " _fmt, current->name, ##_args)
 
 void xencons_rx(char *buf, unsigned len, struct pt_regs *regs);
 void xencons_tx(void);
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/events.h
--- a/extras/mini-os/include/events.h
+++ b/extras/mini-os/include/events.h
@@ -7,9 +7,9 @@
  *        File: events.h
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
  *     Changes: Grzegorz Milos (gm281@xxxxxxxxx)
- *              
+ *
  *        Date: Jul 2003, changes Jun 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Deals with events on the event channels
  *
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/gntmap.h
--- a/extras/mini-os/include/gntmap.h
+++ b/extras/mini-os/include/gntmap.h
@@ -19,7 +19,7 @@ int
 gntmap_munmap(struct gntmap *map, unsigned long start_address, int count);
 
 void*
-gntmap_map_grant_refs(struct gntmap *map, 
+gntmap_map_grant_refs(struct gntmap *map,
                       uint32_t count,
                       uint32_t *domids,
                       int domids_stride,
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/hypervisor.h
--- a/extras/mini-os/include/hypervisor.h
+++ b/extras/mini-os/include/hypervisor.h
@@ -1,8 +1,8 @@
 /******************************************************************************
  * hypervisor.h
- * 
+ *
  * Hypervisor handling.
- * 
+ *
  *
  * Copyright (c) 2002, K A Fraser
  * Copyright (c) 2005, Grzegorz Milos
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/ioremap.h
--- a/extras/mini-os/include/ioremap.h
+++ b/extras/mini-os/include/ioremap.h
@@ -7,16 +7,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/lib-gpl.h
--- a/extras/mini-os/include/lib-gpl.h
+++ b/extras/mini-os/include/lib-gpl.h
@@ -5,10 +5,10 @@
  *
  *        File: lib.h
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: Aug 2003
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Random useful library functions, from Linux'
  * include/linux/kernel.h
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h
+++ b/extras/mini-os/include/lib.h
@@ -5,10 +5,10 @@
  *
  *        File: lib.h
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: Aug 2003
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Random useful library functions, contains some freebsd stuff
  *
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/lwipopts.h
--- a/extras/mini-os/include/lwipopts.h
+++ b/extras/mini-os/include/lwipopts.h
@@ -1,7 +1,7 @@
 /*
  * lwipopts.h
  *
- * Configuration for lwIP running on mini-os 
+ * Configuration for lwIP running on mini-os
  *
  * Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, July 2007
  */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/mm.h
--- a/extras/mini-os/include/mm.h
+++ b/extras/mini-os/include/mm.h
@@ -9,16 +9,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/netfront.h
--- a/extras/mini-os/include/netfront.h
+++ b/extras/mini-os/include/netfront.h
@@ -15,7 +15,7 @@ extern struct wait_queue_head netfront_q
 
 #ifdef HAVE_LWIP
 /* Call this to bring up the netfront interface and the lwIP stack.
- * N.B. _must_ be called from a thread; it's not safe to call this from 
+ * N.B. _must_ be called from a thread; it's not safe to call this from
  * app_main(). */
 void start_networking(void);
 void stop_networking(void);
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/posix/net/if.h
--- a/extras/mini-os/include/posix/net/if.h
+++ b/extras/mini-os/include/posix/net/if.h
@@ -1,5 +1,5 @@
 /*
- * This code is mostly taken from NetBSD net/if.h 
+ * This code is mostly taken from NetBSD net/if.h
  * Changes: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
  *
  ******************************************************************************
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/posix/sys/poll.h
--- a/extras/mini-os/include/posix/sys/poll.h
+++ b/extras/mini-os/include/posix/sys/poll.h
@@ -1,5 +1,5 @@
 /*
- * This code is mostly taken from FreeBSD sys/sys/poll.h 
+ * This code is mostly taken from FreeBSD sys/sys/poll.h
  * Changes: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
  *
  ****************************************************************************
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/sched.h
--- a/extras/mini-os/include/sched.h
+++ b/extras/mini-os/include/sched.h
@@ -33,7 +33,7 @@ void idle_thread_fn(void *unused);
 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
 
 #define switch_threads(prev, next) arch_switch_threads(prev, next)
- 
+
     /* Architecture specific setup of thread creation. */
 struct thread* arch_create_thread(char *name, void (*function)(void *),
                                   void *data);
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/semaphore.h
--- a/extras/mini-os/include/semaphore.h
+++ b/extras/mini-os/include/semaphore.h
@@ -5,7 +5,7 @@
 #include <mini-os/spinlock.h>
 
 /*
- * Implementation of semaphore in Mini-os is simple, because 
+ * Implementation of semaphore in Mini-os is simple, because
  * there are no preemptive threads, the atomicity is guaranteed.
  */
 
@@ -32,10 +32,10 @@ struct rw_semaphore {
 
 #define __MUTEX_INITIALIZER(name) \
     __SEMAPHORE_INITIALIZER(name,1)
-                           
+
 #define __DECLARE_SEMAPHORE_GENERIC(name,count) \
     struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
-    
+
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
 
 #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/sys/time.h
--- a/extras/mini-os/include/sys/time.h
+++ b/extras/mini-os/include/sys/time.h
@@ -8,9 +8,9 @@
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
  *     Changes: Grzegorz Milos (gm281@xxxxxxxxx)
  *              Robert Kaiser (kaiser@xxxxxxxxxxxxxxxxxxxxxxxxxx)
- *              
+ *
  *        Date: Jul 2003, changes: Jun 2005, Sep 2006
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Time and timer functions
  *
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/time.h
--- a/extras/mini-os/include/time.h
+++ b/extras/mini-os/include/time.h
@@ -8,9 +8,9 @@
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
  *     Changes: Grzegorz Milos (gm281@xxxxxxxxx)
  *              Robert Kaiser (kaiser@xxxxxxxxxxxxxxxxxxxxxxxxxx)
- *              
+ *
  *        Date: Jul 2003, changes: Jun 2005, Sep 2006
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Time and timer functions
  *
@@ -27,7 +27,7 @@
  * This value is adjusted by frequency drift.
  * NOW() returns the current time.
  * The other macros are for convenience to approximate short intervals
- * of real time into system time 
+ * of real time into system time
  */
 typedef int64_t s_time_t;
 #define NOW()                   ((s_time_t)monotonic_clock())
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/types.h
--- a/extras/mini-os/include/types.h
+++ b/extras/mini-os/include/types.h
@@ -5,10 +5,10 @@
  *
  *        File: types.h
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: May 2003
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: a random collection of type definitions
  *
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/wait.h
--- a/extras/mini-os/include/wait.h
+++ b/extras/mini-os/include/wait.h
@@ -86,9 +86,9 @@ static inline void wake_up(struct wait_q
     wake(get_current());                                        \
     remove_wait_queue(&wq, &__wait);                            \
     local_irq_restore(flags);                                   \
-} while(0) 
+} while(0)
 
-#define wait_event(wq, condition) wait_event_deadline(wq, condition, 0) 
+#define wait_event(wq, condition) wait_event_deadline(wq, condition, 0)
 
 
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/x86/arch_limits.h
--- a/extras/mini-os/include/x86/arch_limits.h
+++ b/extras/mini-os/include/x86/arch_limits.h
@@ -16,5 +16,5 @@
 
 #define __STACK_SIZE_PAGE_ORDER  4
 #define __STACK_SIZE             (__PAGE_SIZE * (1 << __STACK_SIZE_PAGE_ORDER))
-          
+
 #endif /* __ARCH_LIMITS_H__ */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/x86/arch_mm.h
--- a/extras/mini-os/include/x86/arch_mm.h
+++ b/extras/mini-os/include/x86/arch_mm.h
@@ -9,16 +9,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/x86/arch_sched.h
--- a/extras/mini-os/include/x86/arch_sched.h
+++ b/extras/mini-os/include/x86/arch_sched.h
@@ -7,11 +7,11 @@
 static inline struct thread* get_current(void)
 {
     struct thread **current;
-#ifdef __i386__    
+#ifdef __i386__
     register unsigned long sp asm("esp");
 #else
     register unsigned long sp asm("rsp");
-#endif 
+#endif
     current = (void *)(unsigned long)(sp & ~(__STACK_SIZE-1));
     return *current;
 }
@@ -21,5 +21,5 @@ extern void __arch_switch_threads(unsign
 #define arch_switch_threads(prev,next) __arch_switch_threads(&(prev)->sp, 
&(next)->sp)
 
 
-          
+
 #endif /* __ARCH_SCHED_H__ */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/x86/os.h
--- a/extras/mini-os/include/x86/os.h
+++ b/extras/mini-os/include/x86/os.h
@@ -1,6 +1,6 @@
 /******************************************************************************
  * os.h
- * 
+ *
  * random collection of macros and definition
  */
 
@@ -72,7 +72,7 @@ void arch_fini(void);
 
 
 
-/* 
+/*
  * The use of 'barrier' in the following reflects their use as local-lock
  * operations. Reentrancy must be prevented (e.g., __cli()) /before/ following
  * critical operations are executed. All critical operations must complete
@@ -347,7 +347,7 @@ static inline unsigned long __xchg(unsig
  * @nr: Bit to clear
  * @addr: Address to count from
  *
- * This operation is atomic and cannot be reordered.  
+ * This operation is atomic and cannot be reordered.
  * It also implies a memory barrier.
  */
 static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
@@ -515,7 +515,7 @@ static inline unsigned long __synch_cmpx
 
 static __inline__ void synch_set_bit(int nr, volatile void * addr)
 {
-    __asm__ __volatile__ ( 
+    __asm__ __volatile__ (
         "lock btsl %1,%0"
         : "=m" (ADDR) : "Ir" (nr) : "memory" );
 }
@@ -547,7 +547,7 @@ static __inline__ int synch_test_and_cle
 
 static __inline__ int synch_const_test_bit(int nr, const volatile void * addr)
 {
-    return ((1UL << (nr & 31)) & 
+    return ((1UL << (nr & 31)) &
             (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
 }
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/include/x86/traps.h
--- a/extras/mini-os/include/x86/traps.h
+++ b/extras/mini-os/include/x86/traps.h
@@ -1,13 +1,13 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2005 - Grzegorz Milos - Intel Reseach Cambridge
  ****************************************************************************
  *
  *        File: traps.h
  *      Author: Grzegorz Milos (gm281@xxxxxxxxx)
- *              
+ *
  *        Date: Jun 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Deals with traps
  *
@@ -46,7 +46,7 @@ struct pt_regs {
        unsigned long rbx;
 /* arguments: non interrupts/non tracing syscalls only save upto here*/
        unsigned long r11;
-       unsigned long r10;      
+       unsigned long r10;
        unsigned long r9;
        unsigned long r8;
        unsigned long rax;
@@ -55,14 +55,14 @@ struct pt_regs {
        unsigned long rsi;
        unsigned long rdi;
        unsigned long orig_rax;
-/* end of arguments */         
+/* end of arguments */
 /* cpu exception frame or undefined */
        unsigned long rip;
        unsigned long cs;
-       unsigned long eflags; 
-       unsigned long rsp; 
+       unsigned long eflags;
+       unsigned long rsp;
        unsigned long ss;
-/* top of stack page */ 
+/* top of stack page */
 };
 
 
diff -r 121ae49aabcb -r 7784cd3925c5 
extras/mini-os/include/x86/x86_32/hypercall-x86_32.h
--- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h
+++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h
@@ -1,23 +1,23 @@
 /******************************************************************************
  * hypercall-x86_32.h
- * 
+ *
  * Copied from XenLinux.
- * 
+ *
  * Copyright (c) 2002-2004, K A Fraser
- * 
+ *
  * This file may be distributed separately from the Linux kernel, or
  * incorporated into other software packages, subject to the following license:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this source file (the "Software"), to deal in the Software without
  * restriction, including without limitation the rights to use, copy, modify,
  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
  * and to permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
diff -r 121ae49aabcb -r 7784cd3925c5 
extras/mini-os/include/x86/x86_64/hypercall-x86_64.h
--- a/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h
+++ b/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h
@@ -1,27 +1,27 @@
 /******************************************************************************
  * hypercall-x86_64.h
- * 
+ *
  * Copied from XenLinux.
- * 
+ *
  * Copyright (c) 2002-2004, K A Fraser
- * 
+ *
  * 64-bit updates:
  *   Benjamin Liu <benjamin.liu@xxxxxxxxx>
  *   Jun Nakajima <jun.nakajima@xxxxxxxxx>
- * 
+ *
  * This file may be distributed separately from the Linux kernel, or
  * incorporated into other software packages, subject to the following license:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this source file (the "Software"), to deal in the Software without
  * restriction, including without limitation the rights to use, copy, modify,
  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
  * and to permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -155,7 +155,7 @@ HYPERVISOR_stack_switch(
 
 static inline int
 HYPERVISOR_set_callbacks(
-       unsigned long event_address, unsigned long failsafe_address, 
+       unsigned long event_address, unsigned long failsafe_address,
        unsigned long syscall_address)
 {
        return _hypercall3(int, set_callbacks,
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c
+++ b/extras/mini-os/kernel.c
@@ -1,29 +1,29 @@
 /******************************************************************************
  * kernel.c
- * 
+ *
  * Assorted crap goes here, including the initial C entry point, jumped at
  * from head.S.
- * 
+ *
  * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
  * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
  * Copyright (c) 2006, Robert Kaiser, FH Wiesbaden
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -54,12 +54,12 @@ void setup_xen_features(void)
     xen_feature_info_t fi;
     int i, j;
 
-    for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) 
+    for (i = 0; i < XENFEAT_NR_SUBMAPS; i++)
     {
         fi.submap_idx = i;
         if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
             break;
-        
+
         for (j=0; j<32; j++)
             xen_features[i*32+j] = !!(fi.submap & 1<<j);
     }
@@ -90,18 +90,18 @@ void start_kernel(start_info_t *si)
     printk("  start_info: %p(VA)\n", si);
     printk("    nr_pages: 0x%lx\n", si->nr_pages);
     printk("  shared_inf: 0x%08lx(MA)\n", si->shared_info);
-    printk("     pt_base: %p(VA)\n", (void *)si->pt_base); 
+    printk("     pt_base: %p(VA)\n", (void *)si->pt_base);
     printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames);
-    printk("    mfn_list: %p(VA)\n", (void *)si->mfn_list); 
+    printk("    mfn_list: %p(VA)\n", (void *)si->mfn_list);
     printk("   mod_start: 0x%lx(VA)\n", si->mod_start);
-    printk("     mod_len: %lu\n", si->mod_len); 
+    printk("     mod_len: %lu\n", si->mod_len);
     printk("       flags: 0x%x\n", (unsigned int)si->flags);
-    printk("    cmd_line: %s\n",  
+    printk("    cmd_line: %s\n",
            si->cmd_line ? (const char *)si->cmd_line : "NULL");
 
     /* Set up events. */
     init_events();
-    
+
     /* ENABLE EVENT DELIVERY. This is disabled at start of day. */
     __sti();
 
@@ -124,10 +124,10 @@ void start_kernel(start_info_t *si)
 
     /* Init grant tables */
     init_gnttab();
-    
+
     /* Init scheduler. */
     init_sched();
- 
+
     /* Init XenBus */
     init_xenbus();
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/lib/math.c
--- a/extras/mini-os/lib/math.c
+++ b/extras/mini-os/lib/math.c
@@ -5,10 +5,10 @@
  *
  *        File: math.c
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: Aug 2003
- * 
+ *
  * Environment: Xen Minimal OS
  * Description:  Library functions for 64bit arith and other
  *               from freebsd, files in sys/libkern/ (qdivrem.c, etc)
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/lib/printf.c
--- a/extras/mini-os/lib/printf.c
+++ b/extras/mini-os/lib/printf.c
@@ -5,7 +5,7 @@
  *
  *        File: printf.c
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
- *     Changes: Grzegorz Milos (gm281@xxxxxxxxx) 
+ *     Changes: Grzegorz Milos (gm281@xxxxxxxxx)
  *
  *        Date: Aug 2003, Aug 2005
  *
@@ -199,7 +199,7 @@ static char * number(char * buf, char * 
     i = 0;
     if (num == 0)
         tmp[i++]='0';
-    else 
+    else
     {
         /* XXX KAF: force unsigned mod and div. */
         unsigned long long num2=(unsigned long long)num;
@@ -589,7 +589,7 @@ int vsscanf(const char * buf, const char
                if (!*fmt)
                        break;
                ++fmt;
-               
+
                /* skip this conversion.
                 * advance both strings to next white space
                 */
@@ -678,7 +678,7 @@ int vsscanf(const char * buf, const char
                        break;
                case '%':
                        /* looking for '%' in str */
-                       if (*str++ != '%') 
+                       if (*str++ != '%')
                                return num;
                        continue;
                default:
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/lib/string.c
--- a/extras/mini-os/lib/string.c
+++ b/extras/mini-os/lib/string.c
@@ -5,10 +5,10 @@
  *
  *        File: string.c
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: Aug 2003
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Library function for string and memory manipulation
  *              Origin unknown
@@ -151,12 +151,12 @@ size_t strnlen(const char * s, size_t co
 char * strcat(char * dest, const char * src)
 {
     char *tmp = dest;
-    
+
     while (*dest)
         dest++;
-    
+
     while ((*dest++ = *src++) != '\0');
-    
+
     return tmp;
 }
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c
+++ b/extras/mini-os/lib/sys.c
@@ -529,8 +529,8 @@ int fstat(int fd, struct stat *buf)
            buf->st_uid = 0;
            buf->st_gid = 0;
            buf->st_size = 0;
-           buf->st_atime = 
-           buf->st_mtime = 
+           buf->st_atime =
+           buf->st_mtime =
            buf->st_ctime = time(NULL);
            return 0;
        }
@@ -618,7 +618,7 @@ DIR *opendir(const char *name)
 struct dirent *readdir(DIR *dir)
 {
     return NULL;
-} 
+}
 
 int closedir(DIR *dir)
 {
@@ -1328,7 +1328,7 @@ unsupported_function_crash(umask);
 /* We could support that.  */
 unsupported_function_log(int, chdir, -1);
 
-/* No dynamic library support.  */ 
+/* No dynamic library support.  */
 unsupported_function_log(void *, dlopen, NULL);
 unsupported_function_log(void *, dlsym, NULL);
 unsupported_function_log(char *, dlerror, NULL);
@@ -1368,7 +1368,7 @@ unsupported_function_log(char *, if_inde
 unsupported_function_log(struct  if_nameindex *, if_nameindex, (struct  
if_nameindex *) NULL);
 unsupported_function_crash(if_freenameindex);
 
-/* Linuxish abi for the Caml runtime, don't support 
+/* Linuxish abi for the Caml runtime, don't support
    Log, and return an error code if possible.  If it is not possible
    to inform the application of an error, then crash instead!
 */
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/lib/xmalloc.c
--- a/extras/mini-os/lib/xmalloc.c
+++ b/extras/mini-os/lib/xmalloc.c
@@ -1,4 +1,4 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
  ****************************************************************************
@@ -6,11 +6,11 @@
  *        File: xmaloc.c
  *      Author: Grzegorz Milos (gm281@xxxxxxxxx)
  *              Samuel Thibault (samuel.thibault@xxxxxxxxxxxxx)
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: Aug 2005
  *              Jan 2008
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: simple memory allocator
  *
@@ -286,9 +286,9 @@ void *_realloc(void *ptr, size_t size)
        maybe_split(hdr, pad->hdr_size + size, hdr->size);
         return ptr;
     }
-    
+
     new = _xmalloc(size, DEFAULT_ALIGN);
-    if (new == NULL) 
+    if (new == NULL)
         return NULL;
 
     memcpy(new, ptr, old_data_size);
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/lwip-arch.c
--- a/extras/mini-os/lwip-arch.c
+++ b/extras/mini-os/lwip-arch.c
@@ -1,7 +1,7 @@
-/* 
+/*
  * lwip-arch.c
  *
- * Arch-specific semaphores and mailboxes for lwIP running on mini-os 
+ * Arch-specific semaphores and mailboxes for lwIP running on mini-os
  *
  * Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, July 2007
  */
@@ -44,7 +44,7 @@ void sys_sem_signal(sys_sem_t sem)
  * signaled. If the "timeout" argument is non-zero, the thread should
  * only be blocked for the specified time (measured in
  * milliseconds).
- * 
+ *
  * If the timeout argument is non-zero, the return value is the number of
  * milliseconds spent waiting for the semaphore to be signaled. If the
  * semaphore wasn't signaled within the specified time, the return value is
@@ -76,9 +76,9 @@ uint32_t sys_arch_sem_wait(sys_sem_t sem
     if (sem->count > 0) {
         sem->count--;
         sys_arch_unprotect(prot);
-        return NSEC_TO_MSEC(NOW() - then); 
+        return NSEC_TO_MSEC(NOW() - then);
     }
-    
+
     sys_arch_unprotect(prot);
     return SYS_ARCH_TIMEOUT;
 }
@@ -215,12 +215,12 @@ uint32_t sys_arch_mbox_tryfetch(sys_mbox
  * each thread has a list of timeouts which is repressented as a linked
  * list of sys_timeout structures. The sys_timeouts structure holds a
  * pointer to a linked list of timeouts. This function is called by
- * the lwIP timeout scheduler and must not return a NULL value. 
+ * the lwIP timeout scheduler and must not return a NULL value.
  *
  * In a single threadd sys_arch implementation, this function will
  * simply return a pointer to a global sys_timeouts variable stored in
  * the sys_arch module. */
-struct sys_timeouts *sys_arch_timeouts(void) 
+struct sys_timeouts *sys_arch_timeouts(void)
 {
     static struct sys_timeouts timeout;
     return &timeout;
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/lwip-net.c
--- a/extras/mini-os/lwip-net.c
+++ b/extras/mini-os/lwip-net.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * lwip-net.c
  *
  * interface between lwIP's ethernet and Mini-os's netfront.
@@ -11,9 +11,9 @@
 
 /*
  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without 
modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -22,21 +22,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 
EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 
EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Adam Dunkels <adam@xxxxxxx>
  *
  */
@@ -118,7 +118,7 @@ low_level_output(struct netif *netif, st
 #if ETH_PAD_SIZE
   pbuf_header(p, ETH_PAD_SIZE);                        /* reclaim the padding 
word */
 #endif
-  
+
   LINK_STATS_INC(link.xmit);
 
   return ERR_OK;
@@ -139,17 +139,17 @@ static err_t
 netfront_output(struct netif *netif, struct pbuf *p,
       struct ip_addr *ipaddr)
 {
-  
+
  /* resolve hardware address, then send (or queue) packet */
   return etharp_output(netif, p, ipaddr);
- 
+
 }
 
 /*
  * netfront_input():
  *
  * This function should be called when a packet is ready to be read
- * from the interface. 
+ * from the interface.
  *
  */
 
@@ -162,7 +162,7 @@ netfront_input(struct netif *netif, unsi
 #if ETH_PAD_SIZE
   len += ETH_PAD_SIZE; /* allow room for Ethernet padding */
 #endif
-  
+
   /* move received packet into a new pbuf */
   p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
   if (p == NULL) {
@@ -174,7 +174,7 @@ netfront_input(struct netif *netif, unsi
 #if ETH_PAD_SIZE
   pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
 #endif
-  
+
   /* We iterate over the pbuf chain until we have read the entire
    * packet into the pbuf. */
   for(q = p; q != NULL && len > 0; q = q->next) {
@@ -196,7 +196,7 @@ netfront_input(struct netif *netif, unsi
   ethhdr = p->payload;
 
   ethhdr = p->payload;
-    
+
   switch (htons(ethhdr->type)) {
   /* IP packet? */
   case ETHTYPE_IP:
@@ -213,7 +213,7 @@ netfront_input(struct netif *netif, unsi
       /* Could not store it, drop */
       pbuf_free(p);
     break;
-      
+
   case ETHTYPE_ARP:
     /* pass p to ARP module  */
     etharp_arp_input(netif, (struct eth_addr *) netif->hwaddr, p);
@@ -227,10 +227,10 @@ netfront_input(struct netif *netif, unsi
 }
 
 
-/* 
+/*
  * netif_rx(): overrides the default netif_rx behaviour in the netfront driver.
- * 
- * Pull received packets into a pbuf queue for the low_level_input() 
+ *
+ * Pull received packets into a pbuf queue for the low_level_input()
  * function to pass up to lwIP.
  */
 
@@ -290,14 +290,14 @@ netif_netfront_init(struct netif *netif)
   netif->ifoutnucastpkts = 0;
   netif->ifoutdiscards = 0;
 #endif
-  
+
   netif->name[0] = IFNAME0;
   netif->name[1] = IFNAME1;
   netif->output = netfront_output;
   netif->linkoutput = low_level_output;
-  
+
   the_interface = netif;
-  
+
   /* set MAC hardware address */
   netif->hwaddr_len = 6;
   netif->hwaddr[0] = mac[0];
@@ -312,7 +312,7 @@ netif_netfront_init(struct netif *netif)
 
   /* maximum transfer unit */
   netif->mtu = 1500;
-  
+
   /* broadcast capability */
   netif->flags = NETIF_FLAG_BROADCAST;
 
@@ -333,10 +333,10 @@ static void tcpip_bringup_finished(void 
   up(&tcpip_is_up);
 }
 
-/* 
- * Utility function to bring the whole lot up.  Call this from app_main() 
+/*
+ * Utility function to bring the whole lot up.  Call this from app_main()
  * or similar -- it starts netfront and have lwIP start its thread,
- * which calls back to tcpip_bringup_finished(), which 
+ * which calls back to tcpip_bringup_finished(), which
  * lets us know it's OK to continue.
  */
 void start_networking(void)
@@ -350,7 +350,7 @@ void start_networking(void)
   tprintk("Waiting for network.\n");
 
   dev = init_netfront(NULL, NULL, rawmac, &ip);
-  
+
   if (ip) {
     ipaddr.addr = inet_addr(ip);
     if (IN_CLASSA(ntohl(ipaddr.addr)))
@@ -364,13 +364,13 @@ void start_networking(void)
   }
   tprintk("IP %x netmask %x gateway %x.\n",
           ntohl(ipaddr.addr), ntohl(netmask.addr), ntohl(gw.addr));
-  
+
   tprintk("TCP/IP bringup begins.\n");
-  
+
   netif = xmalloc(struct netif);
   tcpip_init(tcpip_bringup_finished, netif);
-    
-  netif_add(netif, &ipaddr, &netmask, &gw, rawmac, 
+
+  netif_add(netif, &ipaddr, &netmask, &gw, rawmac,
             netif_netfront_init, ip_input);
   netif_set_default(netif);
   netif_set_up(netif);
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/mm.c
--- a/extras/mini-os/mm.c
+++ b/extras/mini-os/mm.c
@@ -1,4 +1,4 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
  * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
@@ -7,9 +7,9 @@
  *        File: mm.c
  *      Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
  *     Changes: Grzegorz Milos
- *              
+ *
  *        Date: Aug 2003, chages Aug 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: memory management related functions
  *              contains buddy page allocator from Xen.
@@ -21,16 +21,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -62,7 +62,7 @@ static unsigned long *alloc_bitmap;
 
 /*
  * Hint regarding bitwise arithmetic in map_{alloc,free}:
- *  -(1<<n)  sets all bits >= n. 
+ *  -(1<<n)  sets all bits >= n.
  *  (1<<n)-1 sets all bits <  n.
  * Variable names in map_{alloc,free}:
  *  *_idx == Index into `alloc_bitmap' array.
@@ -82,7 +82,7 @@ static void map_alloc(unsigned long firs
     {
         alloc_bitmap[curr_idx] |= ((1UL<<end_off)-1) & -(1UL<<start_off);
     }
-    else 
+    else
     {
         alloc_bitmap[curr_idx] |= -(1UL<<start_off);
         while ( ++curr_idx < end_idx ) alloc_bitmap[curr_idx] = ~0UL;
@@ -104,7 +104,7 @@ static void map_free(unsigned long first
     {
         alloc_bitmap[curr_idx] &= -(1UL<<end_off) | ((1UL<<start_off)-1);
     }
-    else 
+    else
     {
         alloc_bitmap[curr_idx] &= (1UL<<start_off)-1;
         while ( ++curr_idx != end_idx ) alloc_bitmap[curr_idx] = 0;
@@ -152,8 +152,8 @@ USED static void print_allocation(void *
     for(count = 0; count < nr_pages; count++)
         if(allocated_in_map(pfn_start + count)) printk("1");
         else printk("0");
-        
-    printk("\n");        
+
+    printk("\n");
 }
 
 /*
@@ -166,13 +166,13 @@ USED static void print_chunks(void *star
     int order, count;
     chunk_head_t *head;
     unsigned long pfn_start = virt_to_pfn(start);
-   
+
     memset(chunks, (int)'_', 1000);
-    if(nr_pages > 1000) 
+    if(nr_pages > 1000)
     {
         DEBUG("Can only pring 1000 pages. Increase buffer size.");
     }
-    
+
     for(order=0; order < FREELIST_SIZE; order++)
     {
         head = free_head[order];
@@ -264,12 +264,12 @@ unsigned long alloc_pages(int order)
 
     /* Find smallest order which can satisfy the request. */
     for ( i = order; i < FREELIST_SIZE; i++ ) {
-       if ( !FREELIST_EMPTY(free_head[i]) ) 
+       if ( !FREELIST_EMPTY(free_head[i]) )
            break;
     }
 
     if ( i == FREELIST_SIZE ) goto no_memory;
- 
+
     /* Unlink a chunk. */
     alloc_ch = free_head[i];
     free_head[i] = alloc_ch->next;
@@ -293,7 +293,7 @@ unsigned long alloc_pages(int order)
         spare_ch->next->pprev = &spare_ch->next;
         free_head[i] = spare_ch;
     }
-    
+
     map_alloc(PHYS_PFN(to_phys(alloc_ch)), 1UL<<order);
 
     return((unsigned long)alloc_ch);
@@ -310,43 +310,43 @@ void free_pages(void *pointer, int order
     chunk_head_t *freed_ch, *to_merge_ch;
     chunk_tail_t *freed_ct;
     unsigned long mask;
-    
+
     /* First free the chunk */
     map_free(virt_to_pfn(pointer), 1UL << order);
-    
+
     /* Create free chunk */
     freed_ch = (chunk_head_t *)pointer;
     freed_ct = (chunk_tail_t *)((char *)pointer + (1UL<<(order + 
PAGE_SHIFT)))-1;
-    
+
     /* Now, possibly we can conseal chunks together */
     while(order < FREELIST_SIZE)
     {
         mask = 1UL << (order + PAGE_SHIFT);
-        if((unsigned long)freed_ch & mask) 
+        if((unsigned long)freed_ch & mask)
         {
             to_merge_ch = (chunk_head_t *)((char *)freed_ch - mask);
             if(allocated_in_map(virt_to_pfn(to_merge_ch)) ||
                     to_merge_ch->level != order)
                 break;
-            
+
             /* Merge with predecessor */
-            freed_ch = to_merge_ch;   
+            freed_ch = to_merge_ch;
         }
-        else 
+        else
         {
             to_merge_ch = (chunk_head_t *)((char *)freed_ch + mask);
             if(allocated_in_map(virt_to_pfn(to_merge_ch)) ||
                     to_merge_ch->level != order)
                 break;
-            
+
             /* Merge with successor */
             freed_ct = (chunk_tail_t *)((char *)to_merge_ch + mask) - 1;
         }
-        
+
         /* We are commited to merging, unlink the chunk */
         *(to_merge_ch->pprev) = to_merge_ch->next;
         to_merge_ch->next->pprev = to_merge_ch->pprev;
-        
+
         order++;
     }
 
@@ -355,10 +355,10 @@ void free_pages(void *pointer, int order
     freed_ch->next  = free_head[order];
     freed_ch->pprev = &free_head[order];
     freed_ct->level = order;
-    
+
     freed_ch->next->pprev = &freed_ch->next;
-    free_head[order] = freed_ch;   
-   
+    free_head[order] = freed_ch;
+
 }
 
 int free_physical_pages(xen_pfn_t *mfns, int n)
@@ -382,7 +382,7 @@ void *sbrk(ptrdiff_t increment)
        printk("Heap exhausted: %p + %lx = %p > %p\n", old_brk, increment, 
new_brk, heap_end);
        return NULL;
     }
-    
+
     if (new_brk > heap_mapped) {
         unsigned long n = (new_brk - heap_mapped + PAGE_SIZE - 1) / PAGE_SIZE;
         do_map_zero(heap_mapped, n);
@@ -409,13 +409,13 @@ void init_mm(void)
      * now we can initialise the page allocator
      */
     printk("MM: Initialise page allocator for %lx(%lx)-%lx(%lx)\n",
-           (u_long)to_virt(PFN_PHYS(start_pfn)), PFN_PHYS(start_pfn), 
+           (u_long)to_virt(PFN_PHYS(start_pfn)), PFN_PHYS(start_pfn),
            (u_long)to_virt(PFN_PHYS(max_pfn)), PFN_PHYS(max_pfn));
     init_page_allocator(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn));
     printk("MM: done\n");
 
     arch_init_p2m(max_pfn);
-    
+
     arch_init_demand_mapping_area(max_pfn);
 }
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c
+++ b/extras/mini-os/netfront.c
@@ -1,4 +1,4 @@
-/* Minimal network driver for Mini-OS. 
+/* Minimal network driver for Mini-OS.
  * Copyright (c) 2006-2007 Jacob Gorm Hansen, University of Copenhagen.
  * Based on netfront.c from Xen Linux.
  *
@@ -162,7 +162,7 @@ moretodo:
         void* page = buf->page;
 
         /* We are sure to have free gnttab entries since they got released 
above */
-        buf->gref = req->gref = 
+        buf->gref = req->gref =
             gnttab_grant_access(dev->dom,virt_to_mfn(page),0);
 
         req->id = id;
@@ -171,7 +171,7 @@ moretodo:
     wmb();
 
     dev->rx.req_prod_pvt = req_prod + i;
-    
+
     RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&dev->rx, notify);
     if (notify)
         notify_remote_via_evtchn(dev->evtchn);
@@ -189,7 +189,7 @@ void network_tx_buf_gc(struct netfront_d
         prod = dev->tx.sring->rsp_prod;
         rmb(); /* Ensure we see responses up to 'rp'. */
 
-        for (cons = dev->tx.rsp_cons; cons != prod; cons++) 
+        for (cons = dev->tx.rsp_cons; cons != prod; cons++)
         {
             struct netif_tx_response *txrsp;
             struct net_buffer *buf;
@@ -571,12 +571,12 @@ void init_rx_buffers(struct netfront_dev
     int notify;
 
     /* Rebuild the RX buffer freelist and the RX ring itself. */
-    for (requeue_idx = 0, i = 0; i < NET_RX_RING_SIZE; i++) 
+    for (requeue_idx = 0, i = 0; i < NET_RX_RING_SIZE; i++)
     {
         struct net_buffer* buf = &dev->rx_buffers[requeue_idx];
         req = RING_GET_REQUEST(&dev->rx, requeue_idx);
 
-        buf->gref = req->gref = 
+        buf->gref = req->gref =
             gnttab_grant_access(dev->dom,virt_to_mfn(buf->page),0);
 
         req->id = requeue_idx;
@@ -588,7 +588,7 @@ void init_rx_buffers(struct netfront_dev
 
     RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&dev->rx, notify);
 
-    if (notify) 
+    if (notify)
         notify_remote_via_evtchn(dev->evtchn);
 
     dev->rx.sring->rsp_event = dev->rx.rsp_cons + 1;
@@ -623,7 +623,7 @@ void netfront_xmit(struct netfront_dev *
 
     memcpy(page,data,len);
 
-    buf->gref = 
+    buf->gref =
         tx->gref = gnttab_grant_access(dev->dom,virt_to_mfn(page),1);
 
     tx->offset=0;
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c
+++ b/extras/mini-os/pcifront.c
@@ -1,4 +1,4 @@
-/* Minimal PCI driver for Mini-OS. 
+/* Minimal PCI driver for Mini-OS.
  * Copyright (c) 2007-2008 Samuel Thibault.
  * Based on blkfront.c.
  */
@@ -157,7 +157,7 @@ struct pcifront_dev *init_pcifront(char 
     printk("******************* PCIFRONT for %s **********\n\n\n", nodename);
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    dom = xenbus_read_integer(path); 
+    dom = xenbus_read_integer(path);
     if (dom == -1) {
         printk("no backend\n");
         return NULL;
@@ -518,7 +518,7 @@ int pcifront_enable_msi(struct pcifront_
     op.devfn = PCI_DEVFN(slot, fun);
 
     pcifront_op(dev, &op);
-    
+
     if (op.err)
         return op.err;
     else
@@ -543,7 +543,7 @@ int pcifront_disable_msi(struct pcifront
     op.devfn = PCI_DEVFN(slot, fun);
 
     pcifront_op(dev, &op);
-    
+
     return op.err;
 }
 
@@ -572,7 +572,7 @@ int pcifront_enable_msix(struct pcifront
     memcpy(op.msix_entries, entries, n * sizeof(*entries));
 
     pcifront_op(dev, &op);
-    
+
     if (op.err)
         return op.err;
 
@@ -600,6 +600,6 @@ int pcifront_disable_msix(struct pcifron
     op.devfn = PCI_DEVFN(slot, fun);
 
     pcifront_op(dev, &op);
-    
+
     return op.err;
 }
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/sched.c
--- a/extras/mini-os/sched.c
+++ b/extras/mini-os/sched.c
@@ -1,4 +1,4 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
  ****************************************************************************
@@ -6,13 +6,13 @@
  *        File: sched.c
  *      Author: Grzegorz Milos
  *     Changes: Robert Kaiser
- *              
+ *
  *        Date: Aug 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: simple scheduler for Mini-Os
  *
- * The scheduler is non-preemptive (cooperative), and schedules according 
+ * The scheduler is non-preemptive (cooperative), and schedules according
  * to Round Robin algorithm.
  *
  ****************************************************************************
@@ -22,16 +22,16 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
@@ -79,7 +79,7 @@ void schedule(void)
     unsigned long flags;
 
     prev = current;
-    local_irq_save(flags); 
+    local_irq_save(flags);
 
     if (in_callback) {
         printk("Must not call schedule() from a callback\n");
@@ -106,7 +106,7 @@ void schedule(void)
                 else if (thread->wakeup_time < min_wakeup_time)
                     min_wakeup_time = thread->wakeup_time;
             }
-            if(is_runnable(thread)) 
+            if(is_runnable(thread))
             {
                 next = thread;
                 /* Put this thread on the end of the list */
@@ -255,17 +255,17 @@ void th_f1(void *data)
         schedule();
         printk("Thread \"%s\" releases the semaphore\n", current->name);
         up(&mutex);
-        
-        
+
+
         gettimeofday(&tv1, NULL);
         for(;;)
         {
             gettimeofday(&tv2, NULL);
             if(tv2.tv_sec - tv1.tv_sec > 2) break;
         }
-                
-        
-        schedule(); 
+
+
+        schedule();
     }
 }
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/test.c
--- a/extras/mini-os/test.c
+++ b/extras/mini-os/test.c
@@ -1,28 +1,28 @@
 /******************************************************************************
  * test.c
- * 
+ *
  * Test code for all the various frontends; split from kernel.c
- * 
+ *
  * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
  * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
  * Copyright (c) 2006, Robert Kaiser, FH Wiesbaden
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
 
diff -r 121ae49aabcb -r 7784cd3925c5 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c
+++ b/extras/mini-os/xenbus/xenbus.c
@@ -1,15 +1,15 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2006 - Cambridge University
  ****************************************************************************
  *
  *        File: xenbus.c
- *      Author: Steven Smith (sos22@xxxxxxxxx) 
+ *      Author: Steven Smith (sos22@xxxxxxxxx)
  *     Changes: Grzegorz Milos (gm281@xxxxxxxxx)
  *     Changes: John D. Ramsdell
- *              
+ *
  *        Date: Jun 2006, chages Aug 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Minimal implementation of xenbus
  *
@@ -51,7 +51,7 @@ static struct watch {
     xenbus_event_queue *events;
     struct watch *next;
 } *watches;
-struct xenbus_req_info 
+struct xenbus_req_info
 {
     int in_use:1;
     struct wait_queue_head waitq;
@@ -196,10 +196,10 @@ static void xenbus_thread_func(void *ign
     struct xsd_sockmsg msg;
     unsigned prod = xenstore_buf->rsp_prod;
 
-    for (;;) 
+    for (;;)
     {
         wait_event(xb_waitq, prod != xenstore_buf->rsp_prod);
-        while (1) 
+        while (1)
         {
             prod = xenstore_buf->rsp_prod;
             DEBUG("Rsp_cons %d, rsp_prod %d.\n", xenstore_buf->rsp_cons,
@@ -298,7 +298,7 @@ static int allocate_xenbus_id(void)
     static int probe;
     int o_probe;
 
-    while (1) 
+    while (1)
     {
         spin_lock(&req_lock);
         if (nr_live_reqs < NR_REQS)
@@ -308,7 +308,7 @@ static int allocate_xenbus_id(void)
     }
 
     o_probe = probe;
-    for (;;) 
+    for (;;)
     {
         if (!req_info[o_probe].in_use)
             break;
@@ -373,7 +373,7 @@ static void xb_write(int type, int req_i
     /* Wait for the ring to drain to the point where we can send the
        message. */
     prod = xenstore_buf->req_prod;
-    if (prod + len - xenstore_buf->req_cons > XENSTORE_RING_SIZE) 
+    if (prod + len - xenstore_buf->req_cons > XENSTORE_RING_SIZE)
     {
         /* Wait for there to be space on the ring */
         DEBUG("prod %d, len %d, cons %d, size %d; waiting.\n",
@@ -389,7 +389,7 @@ static void xb_write(int type, int req_i
        overflowing the ring.  Do so. */
     total_off = 0;
     req_off = 0;
-    while (total_off < len) 
+    while (total_off < len)
     {
         this_chunk = min(cur_req->len - req_off,
                 XENSTORE_RING_SIZE - MASK_XENSTORE_IDX(prod));
@@ -398,7 +398,7 @@ static void xb_write(int type, int req_i
         prod += this_chunk;
         req_off += this_chunk;
         total_off += this_chunk;
-        if (req_off == cur_req->len) 
+        if (req_off == cur_req->len)
         {
             req_off = 0;
             if (cur_req == &header_req)
@@ -465,7 +465,7 @@ static char *errmsg(struct xsd_sockmsg *
     res[rep->len] = 0;
     free(rep);
     return res;
-}      
+}
 
 /* Send a debug message to xenbus.  Can block. */
 static void xenbus_debug_msg(const char *msg)
@@ -535,7 +535,7 @@ char *xenbus_read(xenbus_transaction_t x
 
 char *xenbus_write(xenbus_transaction_t xbt, const char *path, const char 
*value)
 {
-    struct write_req req[] = { 
+    struct write_req req[] = {
        {path, strlen(path) + 1},
        {value, strlen(value)},
     };
@@ -552,7 +552,7 @@ char* xenbus_watch_path_token( xenbus_tr
 {
     struct xsd_sockmsg *rep;
 
-    struct write_req req[] = { 
+    struct write_req req[] = {
         {path, strlen(path) + 1},
        {token, strlen(token) + 1},
     };
@@ -582,7 +582,7 @@ char* xenbus_unwatch_path_token( xenbus_
 {
     struct xsd_sockmsg *rep;
 
-    struct write_req req[] = { 
+    struct write_req req[] = {
         {path, strlen(path) + 1},
        {token, strlen(token) + 1},
     };
@@ -644,7 +644,7 @@ char *xenbus_get_perms(xenbus_transactio
 char *xenbus_set_perms(xenbus_transaction_t xbt, const char *path, domid_t 
dom, char perm)
 {
     char value[PERM_MAX_SIZE];
-    struct write_req req[] = { 
+    struct write_req req[] = {
        {path, strlen(path) + 1},
        {value, 0},
     };
@@ -786,7 +786,7 @@ static void do_ls_test(const char *pre)
        free(msg);
        return;
     }
-    for (x = 0; dirs[x]; x++) 
+    for (x = 0; dirs[x]; x++)
     {
         printk("ls %s[%d] -> %s\n", pre, x, dirs[x]);
         free(dirs[x]);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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