# HG changeset patch
# User sos22@xxxxxxxxxxxxxxxxxxxx
# Node ID 52bddfb334ae233bc6c93f5d5ef89b8c14010e60
# Parent 393256b2ead0c883e2095479e1c66d2e34d18a10
Make sure that accesses to the machine_to_phys table all go through
suitable macros.
Signed-off-by: Steven Smith, sos22@xxxxxxxxx
diff -r 393256b2ead0 -r 52bddfb334ae tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c Tue Nov 22 18:10:50 2005
+++ b/tools/libxc/xc_linux_save.c Wed Nov 23 12:34:25 2005
@@ -44,6 +44,9 @@
/* Live mapping of system MFN to PFN table. */
static unsigned long *live_m2p = NULL;
+/* grep fodder: machine_to_phys */
+
+#define mfn_to_pfn(_mfn) live_m2p[(_mfn)]
/*
* Returns TRUE if the given machine frame number has a unique mapping
@@ -51,8 +54,8 @@
*/
#define MFN_IS_IN_PSEUDOPHYS_MAP(_mfn) \
(((_mfn) < (max_mfn)) && \
- ((live_m2p[_mfn] < (max_pfn)) && \
- (live_p2m[live_m2p[_mfn]] == (_mfn))))
+ ((mfn_to_pfn(_mfn) < (max_pfn)) && \
+ (live_p2m[mfn_to_pfn(_mfn)] == (_mfn))))
/* Returns TRUE if MFN is successfully converted to a PFN. */
@@ -63,7 +66,7 @@
if ( !MFN_IS_IN_PSEUDOPHYS_MAP(mfn) ) \
_res = 0; \
else \
- *(_pmfn) = live_m2p[mfn]; \
+ *(_pmfn) = mfn_to_pfn(mfn); \
_res; \
})
@@ -477,9 +480,7 @@
type, i, (unsigned long long)pte, mfn);
pfn = 0; /* zap it - we'll retransmit this page later */
} else
- pfn = live_m2p[mfn];
-
-
+ pfn = mfn_to_pfn(mfn);
pte &= 0xffffff0000000fffULL;
pte |= (uint64_t)pfn << PAGE_SHIFT;
@@ -815,9 +816,9 @@
for (i = 0; i < max_pfn; i++) {
mfn = live_p2m[i];
- if((mfn != 0xffffffffUL) && (live_m2p[mfn] != i)) {
+ if((mfn != 0xffffffffUL) && (mfn_to_pfn(mfn) != i)) {
DPRINTF("i=0x%x mfn=%lx live_m2p=%lx\n", i,
- mfn, live_m2p[mfn]);
+ mfn, mfn_to_pfn(mfn));
err++;
}
}
@@ -882,7 +883,7 @@
DPRINTF("%d pfn= %08lx mfn= %08lx %d [mfn]= %08lx\n",
iter, (unsigned long)n, live_p2m[n],
test_bit(n, to_send),
- live_m2p[live_p2m[n]&0xFFFFF]);
+ mfn_to_pfn(live_p2m[n]&0xFFFFF));
}
if (!last_iter && test_bit(n, to_send)&& test_bit(n, to_skip))
@@ -954,7 +955,7 @@
iter,
(pfn_type[j] & LTAB_MASK) | pfn_batch[j],
pfn_type[j],
- live_m2p[pfn_type[j]&(~LTAB_MASK)],
+ mfn_to_pfn(pfn_type[j]&(~LTAB_MASK)),
csum_page(region_base + (PAGE_SIZE*j)));
/* canonicalise mfn->pfn */
@@ -1141,7 +1142,7 @@
ERR("PT base is not in range of pseudophys map");
goto out;
}
- ctxt.ctrlreg[3] = live_m2p[ctxt.ctrlreg[3] >> PAGE_SHIFT] <<
+ ctxt.ctrlreg[3] = mfn_to_pfn(ctxt.ctrlreg[3] >> PAGE_SHIFT) <<
PAGE_SHIFT;
if (!write_exact(io_fd, &ctxt, sizeof(ctxt)) ||
diff -r 393256b2ead0 -r 52bddfb334ae xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c Tue Nov 22 18:10:50 2005
+++ b/xen/arch/x86/x86_32/mm.c Wed Nov 23 12:34:25 2005
@@ -106,7 +106,9 @@
idle_pg_table_l2[l2_linear_offset(RO_MPT_VIRT_START) + i] =
l2e_from_page(pg, (__PAGE_HYPERVISOR | _PAGE_PSE) & ~_PAGE_RW);
}
- memset((void *)RDWR_MPT_VIRT_START, 0x55, mpt_size);
+
+ for ( i = 0; i < max_page; i++)
+ set_pfn_from_mfn(i, 0x55555555);
/* Create page tables for ioremap(). */
for ( i = 0; i < (IOREMAP_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
diff -r 393256b2ead0 -r 52bddfb334ae xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c Tue Nov 22 18:10:50 2005
+++ b/xen/arch/x86/x86_32/traps.c Wed Nov 23 12:34:25 2005
@@ -103,7 +103,7 @@
ptab = map_domain_page(mfn);
ent = ptab[l2_table_offset(addr)];
- pfn = machine_to_phys_mapping[(u32)(ent >> PAGE_SHIFT)];
+ pfn = get_pfn_from_mfn(ent >> PAGE_SHIFT);
printk(" L2 = %"PRIpte" %08lx %s\n", ent, pfn,
(ent & _PAGE_PSE) ? "(PSE)" : "");
unmap_domain_page(ptab);
@@ -113,7 +113,7 @@
ptab = map_domain_page(ent >> PAGE_SHIFT);
ent = ptab[l1_table_offset(addr)];
- pfn = machine_to_phys_mapping[(u32)(ent >> PAGE_SHIFT)];
+ pfn = get_pfn_from_mfn(ent >> PAGE_SHIFT);
printk(" L1 = %"PRIpte" %08lx\n", ent, pfn);
unmap_domain_page(ptab);
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|