WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix read_cr3() and use it.

# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 0e9a0a469c6bec37a5b510a6d39500b022a3f06f
# Parent  9bf99522ce5e2dbb0592565f289c4fb1c78ea79a
Fix read_cr3() and use it.

From: Jan Beulich <JBeulich@xxxxxxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 9bf99522ce5e -r 0e9a0a469c6b 
linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c   Mon Feb 20 17:32:29 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c   Mon Feb 20 17:34:21 2006
@@ -152,10 +152,7 @@
        pmd_t *pmd;
        pte_t *pte;
 
-       asm("movq %%cr3,%0" : "=r" (pgd));
-       pgd = (pgd_t *)machine_to_phys((maddr_t)pgd);
-
-       pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK); 
+       pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
        pgd += pgd_index(address);
        if (bad_address(pgd)) goto bad;
        printk("PGD %lx ", pgd_val(*pgd));
@@ -261,9 +258,7 @@
 
        /* On Xen the line below does not always work. Needs investigating! */
        /*pgd = pgd_offset(current->mm ?: &init_mm, address);*/
-       asm("movq %%cr3,%0" : "=r" (pgd));
-       pgd = (pgd_t *)machine_to_phys((maddr_t)pgd);
-       pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK);
+       pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
        pgd += pgd_index(address);
        pgd_ref = pgd_offset_k(address);
        if (pgd_none(*pgd_ref))
diff -r 9bf99522ce5e -r 0e9a0a469c6b 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h     Mon Feb 
20 17:32:29 2006
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h     Mon Feb 
20 17:34:21 2006
@@ -182,7 +182,7 @@
 #define read_cr3() ({ \
        unsigned long __dummy; \
        asm("movq %%cr3,%0" : "=r" (__dummy)); \
-       return machine_to_phys(__dummy); \
+       machine_to_phys(__dummy); \
 })
 
 static inline unsigned long read_cr4(void)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix read_cr3() and use it., Xen patchbot -unstable <=