WARNING - OLD ARCHIVES

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

xen-devel

[Xen-devel] [PATCH] minios: Fix >4GB machine addresses

To: Xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] minios: Fix >4GB machine addresses
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Tue, 10 Jun 2008 16:57:44 +0100
Delivery-date: Tue, 10 Jun 2008 08:58:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, Xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
minios: Fix >4GB machine addresses

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r ddd995ff5f37 extras/mini-os/arch/x86/mm.c
--- a/extras/mini-os/arch/x86/mm.c      Mon Jun 09 15:27:03 2008 +0100
+++ b/extras/mini-os/arch/x86/mm.c      Tue Jun 10 16:53:41 2008 +0100
@@ -59,7 +59,7 @@
 {   
     pgentry_t *tab = (pgentry_t *)start_info.pt_base;
     unsigned long pt_page = (unsigned long)pfn_to_virt(*pt_pfn); 
-    unsigned long prot_e, prot_t;
+    pgentry_t prot_e, prot_t;
     mmu_update_t mmu_updates[1];
     
     prot_e = prot_t = 0;
@@ -69,7 +69,7 @@
 
     /* We need to clear the page, otherwise we might fail to map it
        as a page table page */
-    memset((unsigned long*)pfn_to_virt(*pt_pfn), 0, PAGE_SIZE);  
+    memset((void*) pt_page, 0, PAGE_SIZE);  
  
     switch ( level )
     {
@@ -99,7 +99,7 @@
 #endif
     tab = pte_to_virt(tab[l3_table_offset(pt_page)]);
 
-    mmu_updates[0].ptr = ((pgentry_t)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 | 
                          (prot_e & ~_PAGE_RW);
@@ -474,7 +474,7 @@
                 if (!pgt || !(addr & L1_MASK))
                     pgt = need_pgt(addr);
                mmu_updates[i].ptr = virt_to_mach(pgt);
-               mmu_updates[i].val = ((f[(done + i) * stride] + (done + i) * 
increment) << PAGE_SHIFT) | prot;
+               mmu_updates[i].val = ((pgentry_t)(f[(done + i) * stride] + 
(done + i) * increment) << PAGE_SHIFT) | prot;
            }
 
            rc = HYPERVISOR_mmu_update(mmu_updates, todo, NULL, id);
diff -r ddd995ff5f37 extras/mini-os/include/x86/arch_mm.h
--- a/extras/mini-os/include/x86/arch_mm.h      Mon Jun 09 15:27:03 2008 +0100
+++ b/extras/mini-os/include/x86/arch_mm.h      Tue Jun 10 16:53:41 2008 +0100
@@ -109,16 +109,16 @@
   (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
 #endif
 
-#define _PAGE_PRESENT  0x001UL
-#define _PAGE_RW       0x002UL
-#define _PAGE_USER     0x004UL
-#define _PAGE_PWT      0x008UL
-#define _PAGE_PCD      0x010UL
-#define _PAGE_ACCESSED 0x020UL
-#define _PAGE_DIRTY    0x040UL
-#define _PAGE_PAT      0x080UL
-#define _PAGE_PSE      0x080UL
-#define _PAGE_GLOBAL   0x100UL
+#define _PAGE_PRESENT  0x001ULL
+#define _PAGE_RW       0x002ULL
+#define _PAGE_USER     0x004ULL
+#define _PAGE_PWT      0x008ULL
+#define _PAGE_PCD      0x010ULL
+#define _PAGE_ACCESSED 0x020ULL
+#define _PAGE_DIRTY    0x040ULL
+#define _PAGE_PAT      0x080ULL
+#define _PAGE_PSE      0x080ULL
+#define _PAGE_GLOBAL   0x100ULL
 
 #if defined(__i386__)
 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
@@ -140,7 +140,7 @@
 
 #define PFN_UP(x)      (((x) + PAGE_SIZE-1) >> L1_PAGETABLE_SHIFT)
 #define PFN_DOWN(x)    ((x) >> L1_PAGETABLE_SHIFT)
-#define PFN_PHYS(x)    ((x) << L1_PAGETABLE_SHIFT)
+#define PFN_PHYS(x)    ((uint64_t)(x) << L1_PAGETABLE_SHIFT)
 #define PHYS_PFN(x)    ((x) >> L1_PAGETABLE_SHIFT)
 
 /* to align the pointer to the (next) page boundary */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] minios: Fix >4GB machine addresses, Samuel Thibault <=