ia64/xen-unstable

changeset 8939:0e9a0a469c6b

Fix read_cr3() and use it.

From: Jan Beulich <JBeulich@novell.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Feb 20 17:34:21 2006 +0000 (2006-02-20)
parents 9bf99522ce5e
children 57af6b1cfa3a
files linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c	Mon Feb 20 17:32:29 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c	Mon Feb 20 17:34:21 2006 +0000
     1.3 @@ -152,10 +152,7 @@ void dump_pagetable(unsigned long addres
     1.4  	pmd_t *pmd;
     1.5  	pte_t *pte;
     1.6  
     1.7 -	asm("movq %%cr3,%0" : "=r" (pgd));
     1.8 -	pgd = (pgd_t *)machine_to_phys((maddr_t)pgd);
     1.9 -
    1.10 -	pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK); 
    1.11 +	pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
    1.12  	pgd += pgd_index(address);
    1.13  	if (bad_address(pgd)) goto bad;
    1.14  	printk("PGD %lx ", pgd_val(*pgd));
    1.15 @@ -261,9 +258,7 @@ static int vmalloc_fault(unsigned long a
    1.16  
    1.17  	/* On Xen the line below does not always work. Needs investigating! */
    1.18  	/*pgd = pgd_offset(current->mm ?: &init_mm, address);*/
    1.19 -	asm("movq %%cr3,%0" : "=r" (pgd));
    1.20 -	pgd = (pgd_t *)machine_to_phys((maddr_t)pgd);
    1.21 -	pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK);
    1.22 +	pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
    1.23  	pgd += pgd_index(address);
    1.24  	pgd_ref = pgd_offset_k(address);
    1.25  	if (pgd_none(*pgd_ref))
     2.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h	Mon Feb 20 17:32:29 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h	Mon Feb 20 17:34:21 2006 +0000
     2.3 @@ -182,7 +182,7 @@ static inline void write_cr0(unsigned lo
     2.4  #define read_cr3() ({ \
     2.5  	unsigned long __dummy; \
     2.6  	asm("movq %%cr3,%0" : "=r" (__dummy)); \
     2.7 -	return machine_to_phys(__dummy); \
     2.8 +	machine_to_phys(__dummy); \
     2.9  })
    2.10  
    2.11  static inline unsigned long read_cr4(void)