ia64/xen-unstable
changeset 10480:a27f56a0ff43
[XEN][PAE] Handle non-page-aligned CR3 when walking
page tables.
Signed-off-by: Keir Fraser <keir@xensource.com>
page tables.
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kfraser@dhcp93.uk.xensource.com |
---|---|
date | Mon Jun 19 14:03:04 2006 +0100 (2006-06-19) |
parents | f7eb907d9bcd |
children | 2a99292b1a8a |
files | xen/arch/x86/traps.c xen/arch/x86/x86_32/traps.c |
line diff
1.1 --- a/xen/arch/x86/traps.c Mon Jun 19 13:06:10 2006 +0100 1.2 +++ b/xen/arch/x86/traps.c Mon Jun 19 14:03:04 2006 +0100 1.3 @@ -633,7 +633,7 @@ static int handle_gdt_ldt_mapping_fault( 1.4 static int __spurious_page_fault( 1.5 unsigned long addr, struct cpu_user_regs *regs) 1.6 { 1.7 - unsigned long mfn = read_cr3() >> PAGE_SHIFT; 1.8 + unsigned long mfn, cr3 = read_cr3(); 1.9 #if CONFIG_PAGING_LEVELS >= 4 1.10 l4_pgentry_t l4e, *l4t; 1.11 #endif 1.12 @@ -658,6 +658,8 @@ static int __spurious_page_fault( 1.13 if ( regs->error_code & PGERR_instr_fetch ) 1.14 disallowed_flags |= _PAGE_NX; 1.15 1.16 + mfn = cr3 >> PAGE_SHIFT; 1.17 + 1.18 #if CONFIG_PAGING_LEVELS >= 4 1.19 l4t = map_domain_page(mfn); 1.20 l4e = l4t[l4_table_offset(addr)]; 1.21 @@ -669,7 +671,10 @@ static int __spurious_page_fault( 1.22 #endif 1.23 1.24 #if CONFIG_PAGING_LEVELS >= 3 1.25 - l3t = map_domain_page(mfn); 1.26 + l3t = map_domain_page(mfn); 1.27 +#ifdef CONFIG_X86_PAE 1.28 + l3t += (cr3 & 0xFE0UL) >> 3; 1.29 +#endif 1.30 l3e = l3t[l3_table_offset(addr)]; 1.31 mfn = l3e_get_pfn(l3e); 1.32 unmap_domain_page(l3t);
2.1 --- a/xen/arch/x86/x86_32/traps.c Mon Jun 19 13:06:10 2006 +0100 2.2 +++ b/xen/arch/x86/x86_32/traps.c Mon Jun 19 14:03:04 2006 +0100 2.3 @@ -72,7 +72,7 @@ void show_registers(struct cpu_user_regs 2.4 2.5 void show_page_walk(unsigned long addr) 2.6 { 2.7 - unsigned long pfn, mfn = read_cr3() >> PAGE_SHIFT; 2.8 + unsigned long pfn, mfn, cr3 = read_cr3(); 2.9 #ifdef CONFIG_X86_PAE 2.10 l3_pgentry_t l3e, *l3t; 2.11 #endif 2.12 @@ -81,8 +81,11 @@ void show_page_walk(unsigned long addr) 2.13 2.14 printk("Pagetable walk from %08lx:\n", addr); 2.15 2.16 + mfn = cr3 >> PAGE_SHIFT; 2.17 + 2.18 #ifdef CONFIG_X86_PAE 2.19 - l3t = map_domain_page(mfn); 2.20 + l3t = map_domain_page(mfn); 2.21 + l3t += (cr3 & 0xFE0UL) >> 3; 2.22 l3e = l3t[l3_table_offset(addr)]; 2.23 mfn = l3e_get_pfn(l3e); 2.24 pfn = get_gpfn_from_mfn(mfn);