From e96d277ba252f785d1146520b794c4e159e34680 Mon Sep 17 00:00:00 2001 From: Stefan Bader Date: Thu, 20 Jan 2011 15:38:23 +0100 Subject: [PATCH] --- yaml --- r: 232095 b: refs/heads/master c: 8e1b4cf2108488ccfb9a3e7ed7cd85a435e01d4b h: refs/heads/master i: 232093: 4732ca7273a502d338653ce440082eaa13cefbdd 232091: ac0e7f527fbce359caccd71eceb816c4c5b691da 232087: 1b0e84b301d2a99b72794dbf70b1bca1cdb56352 232079: 898ec8b75bcaf2bfdd6fb914cbce72cb5da7acec 232063: 3d391049d6884d8809c8920b083746ce062d9f16 v: v3 --- [refs] | 2 +- trunk/arch/x86/xen/p2m.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 394b4164e6d5..d34c95b6844c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7d81c3b9e2e5057c52256e154205143ad4e6e919 +refs/heads/master: 8e1b4cf2108488ccfb9a3e7ed7cd85a435e01d4b diff --git a/trunk/arch/x86/xen/p2m.c b/trunk/arch/x86/xen/p2m.c index 8f2251d2a3f8..ddc81a06edb9 100644 --- a/trunk/arch/x86/xen/p2m.c +++ b/trunk/arch/x86/xen/p2m.c @@ -237,7 +237,25 @@ void __init xen_build_dynamic_phys_to_machine(void) p2m_top[topidx] = mid; } - p2m_top[topidx][mididx] = &mfn_list[pfn]; + /* + * As long as the mfn_list has enough entries to completely + * fill a p2m page, pointing into the array is ok. But if + * not the entries beyond the last pfn will be undefined. + * And guessing that the 'what-ever-there-is' does not take it + * too kindly when changing it to invalid markers, a new page + * is allocated, initialized and filled with the valid part. + */ + if (unlikely(pfn + P2M_PER_PAGE > max_pfn)) { + unsigned long p2midx; + unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE); + p2m_init(p2m); + + for (p2midx = 0; pfn + p2midx < max_pfn; p2midx++) { + p2m[p2midx] = mfn_list[pfn + p2midx]; + } + p2m_top[topidx][mididx] = p2m; + } else + p2m_top[topidx][mididx] = &mfn_list[pfn]; } m2p_override_init();