]> xenbits.xensource.com Git - xen.git/commitdiff
bitkeeper revision 1.1159.170.95 (41e806c1QTDH4lQM5LGTCWlIJEeiSw)
authorsos22@douglas.cl.cam.ac.uk <sos22@douglas.cl.cam.ac.uk>
Fri, 14 Jan 2005 17:52:01 +0000 (17:52 +0000)
committersos22@douglas.cl.cam.ac.uk <sos22@douglas.cl.cam.ac.uk>
Fri, 14 Jan 2005 17:52:01 +0000 (17:52 +0000)
machine_to_phys_mapping isn't direct mapped, and so we can't call virt_to_phys
on it.  Make sure that we don't.

xen/arch/x86/domain.c
xen/arch/x86/memory.c
xen/arch/x86/x86_32/mm.c
xen/include/asm-x86/mm.h

index d0cf493522ef8e1227c094ed5524bf18371931f5..fa73e458eff2c1daf7a270c2fd2a65d0bd9f1b0e 100644 (file)
@@ -227,8 +227,7 @@ void arch_do_createdomain(struct domain *d)
 
         d->shared_info = (void *)alloc_xenheap_page();
         memset(d->shared_info, 0, PAGE_SIZE);
-        d->shared_info->arch.mfn_to_pfn_start = 
-            virt_to_phys(&machine_to_phys_mapping[0])>>PAGE_SHIFT;
+        d->shared_info->arch.mfn_to_pfn_start = m2p_start_mfn;
         SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
         machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 
                                PAGE_SHIFT] = INVALID_P2M_ENTRY;
index 966f92c972b024866dd99598b525387921336a62..e51ae6235fb21141f33298068dbe9d7d6ed35582 100644 (file)
@@ -168,7 +168,7 @@ void __init init_frametable(void)
 
 void arch_init_memory(void)
 {
-    unsigned long mfn, i;
+    unsigned long i;
 
     /*
      * We are rather picky about the layout of 'struct pfn_info'. The
@@ -211,13 +211,13 @@ void arch_init_memory(void)
     dom_io->id = DOMID_IO;
 
     /* M2P table is mappable read-only by privileged domains. */
-    mfn = l2_pgentry_to_pagenr(
-        idle_pg_table[RDWR_MPT_VIRT_START >> L2_PAGETABLE_SHIFT]);
     for ( i = 0; i < 1024; i++ )
     {
-        frame_table[mfn+i].count_info        = PGC_allocated | 1;
-        frame_table[mfn+i].u.inuse.type_info = PGT_gdt_page | 1; /* non-RW */
-        frame_table[mfn+i].u.inuse.domain    = dom_xen;
+        frame_table[m2p_start_mfn+i].count_info        = PGC_allocated | 1;
+       /* gdt to make sure it's only mapped read-only by non-privileged
+          domains. */
+        frame_table[m2p_start_mfn+i].u.inuse.type_info = PGT_gdt_page | 1;
+        frame_table[m2p_start_mfn+i].u.inuse.domain    = dom_xen;
     }
 }
 
index d532ea8e9cb7ca7867a80d6280cc7b7ad4401083..4fc5623dc8be6d296f16ee6f770e27ebf22004e6 100644 (file)
@@ -27,6 +27,8 @@
 #include <asm/fixmap.h>
 #include <asm/domain_page.h>
 
+unsigned long m2p_start_mfn;
+
 static inline void set_pte_phys(unsigned long vaddr,
                                 l1_pgentry_t entry)
 {
@@ -63,6 +65,7 @@ void __init paging_init(void)
     /* Allocate and map the machine-to-phys table. */
     if ( (pg = alloc_domheap_pages(NULL, 10)) == NULL )
         panic("Not enough memory to bootstrap Xen.\n");
+    m2p_start_mfn = page_to_pfn(pg);
     idle_pg_table[RDWR_MPT_VIRT_START >> L2_PAGETABLE_SHIFT] =
         mk_l2_pgentry(page_to_phys(pg) | __PAGE_HYPERVISOR | _PAGE_PSE);
 
index 8f35bd96e78c9440c51dc5d6d0b87d4c1847e6c0..a37f9f25448161a293e378ac7fcfe71a6caf101c 100644 (file)
@@ -218,7 +218,10 @@ void synchronise_pagetables(unsigned long cpu_mask);
 #ifdef __x86_64__
 extern unsigned long *machine_to_phys_mapping;
 #else
+/* Don't call virt_to_phys on this: it isn't direct mapped.  Using
+   m2p_start_mfn instead. */
 #define machine_to_phys_mapping ((unsigned long *)RDWR_MPT_VIRT_START)
+extern unsigned long m2p_start_mfn;
 #endif
 
 #define DEFAULT_GDT_ENTRIES     (LAST_RESERVED_GDT_ENTRY+1)