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

[Xen-changelog] [xen-unstable] [XEN][PAE] Handle non-page-aligned CR3 when walking



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID a27f56a0ff43e9299a73b9979de68571ade25bf3
# Parent  f7eb907d9bcd15989a1899358ca8e26116e88b14
[XEN][PAE] Handle non-page-aligned CR3 when walking
page tables.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/traps.c        |    9 +++++++--
 xen/arch/x86/x86_32/traps.c |    7 +++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff -r f7eb907d9bcd -r a27f56a0ff43 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Mon Jun 19 13:06:10 2006 +0100
+++ b/xen/arch/x86/traps.c      Mon Jun 19 14:03:04 2006 +0100
@@ -633,7 +633,7 @@ static int __spurious_page_fault(
 static int __spurious_page_fault(
     unsigned long addr, struct cpu_user_regs *regs)
 {
-    unsigned long mfn = read_cr3() >> PAGE_SHIFT;
+    unsigned long mfn, cr3 = read_cr3();
 #if CONFIG_PAGING_LEVELS >= 4
     l4_pgentry_t l4e, *l4t;
 #endif
@@ -658,6 +658,8 @@ static int __spurious_page_fault(
     if ( regs->error_code & PGERR_instr_fetch )
         disallowed_flags |= _PAGE_NX;
 
+    mfn = cr3 >> PAGE_SHIFT;
+
 #if CONFIG_PAGING_LEVELS >= 4
     l4t = map_domain_page(mfn);
     l4e = l4t[l4_table_offset(addr)];
@@ -669,7 +671,10 @@ static int __spurious_page_fault(
 #endif
 
 #if CONFIG_PAGING_LEVELS >= 3
-    l3t = map_domain_page(mfn);
+    l3t  = map_domain_page(mfn); 
+#ifdef CONFIG_X86_PAE
+    l3t += (cr3 & 0xFE0UL) >> 3;
+#endif
     l3e = l3t[l3_table_offset(addr)];
     mfn = l3e_get_pfn(l3e);
     unmap_domain_page(l3t);
diff -r f7eb907d9bcd -r a27f56a0ff43 xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c       Mon Jun 19 13:06:10 2006 +0100
+++ b/xen/arch/x86/x86_32/traps.c       Mon Jun 19 14:03:04 2006 +0100
@@ -72,7 +72,7 @@ void show_registers(struct cpu_user_regs
 
 void show_page_walk(unsigned long addr)
 {
-    unsigned long pfn, mfn = read_cr3() >> PAGE_SHIFT;
+    unsigned long pfn, mfn, cr3 = read_cr3();
 #ifdef CONFIG_X86_PAE
     l3_pgentry_t l3e, *l3t;
 #endif
@@ -81,8 +81,11 @@ void show_page_walk(unsigned long addr)
 
     printk("Pagetable walk from %08lx:\n", addr);
 
+    mfn = cr3 >> PAGE_SHIFT;
+
 #ifdef CONFIG_X86_PAE
-    l3t = map_domain_page(mfn);
+    l3t  = map_domain_page(mfn);
+    l3t += (cr3 & 0xFE0UL) >> 3;
     l3e = l3t[l3_table_offset(addr)];
     mfn = l3e_get_pfn(l3e);
     pfn = get_gpfn_from_mfn(mfn);

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


 


Rackspace

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