From: "Jan Beulich" Subject: [PATCH,updated] x86-64 linux: a little cleanup Date: Thu, 16 Feb 2006 17:33:33 +0100 Message-ID: <43F4B76D.76F0.0078.0@novell.com> References: <43F20FC7.76F0.0078.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3B19814D.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part3B19814D.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline The recent change to read_cr3() was not correct, and there actually are two users for it. Jan --=__Part3B19814D.0__= Content-Type: text/plain; name="xenlinux-x86_64-mm-fault-cleanup.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="xenlinux-x86_64-mm-fault-cleanup.patch" Index: head-2006-02-16/arch/x86_64/mm/fault-xen.c =================================================================== --- head-2006-02-16.orig/arch/x86_64/mm/fault-xen.c 2006-02-16 17:05:54.000000000 +0100 +++ head-2006-02-16/arch/x86_64/mm/fault-xen.c 2006-02-16 17:09:03.000000000 +0100 @@ -152,10 +152,7 @@ void dump_pagetable(unsigned long addres 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 @@ static int vmalloc_fault(unsigned long a /* 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)) Index: head-2006-02-16/include/asm-x86_64/mach-xen/asm/system.h =================================================================== --- head-2006-02-16.orig/include/asm-x86_64/mach-xen/asm/system.h 2006-02-16 17:05:54.000000000 +0100 +++ head-2006-02-16/include/asm-x86_64/mach-xen/asm/system.h 2006-02-16 17:09:03.000000000 +0100 @@ -182,7 +182,7 @@ static inline void write_cr0(unsigned lo #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) --=__Part3B19814D.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part3B19814D.0__=--