[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] linux/x86: utilize lookup_address() for virt_to_ptep()
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1210860871 -3600 # Node ID c6e36a53cf054df48d892da2bb0145a5f111387a # Parent c3f9cc7789af995b7edfa8a8de4ae099a3750e9e linux/x86: utilize lookup_address() for virt_to_ptep() Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- arch/x86_64/mm/pageattr-xen.c | 2 +- include/asm-i386/mach-xen/asm/pgtable.h | 17 +++++++---------- include/asm-x86_64/mach-xen/asm/pgtable.h | 19 +++++++++---------- 3 files changed, 17 insertions(+), 21 deletions(-) diff -r c3f9cc7789af -r c6e36a53cf05 arch/x86_64/mm/pageattr-xen.c --- a/arch/x86_64/mm/pageattr-xen.c Thu May 15 10:03:29 2008 +0100 +++ b/arch/x86_64/mm/pageattr-xen.c Thu May 15 15:14:31 2008 +0100 @@ -276,7 +276,7 @@ void pte_free(struct page *pte) } #endif /* CONFIG_XEN */ -static inline pte_t *lookup_address(unsigned long address) +pte_t *lookup_address(unsigned long address) { pgd_t *pgd = pgd_offset_k(address); pud_t *pud; diff -r c3f9cc7789af -r c6e36a53cf05 include/asm-i386/mach-xen/asm/pgtable.h --- a/include/asm-i386/mach-xen/asm/pgtable.h Thu May 15 10:03:29 2008 +0100 +++ b/include/asm-i386/mach-xen/asm/pgtable.h Thu May 15 15:14:31 2008 +0100 @@ -477,19 +477,16 @@ void make_pages_readonly(void *va, unsig void make_pages_readonly(void *va, unsigned int nr, unsigned int feature); void make_pages_writable(void *va, unsigned int nr, unsigned int feature); -#define virt_to_ptep(__va) \ +#define virt_to_ptep(va) \ ({ \ - pgd_t *__pgd = pgd_offset_k((unsigned long)(__va)); \ - pud_t *__pud = pud_offset(__pgd, (unsigned long)(__va)); \ - pmd_t *__pmd = pmd_offset(__pud, (unsigned long)(__va)); \ - pte_offset_kernel(__pmd, (unsigned long)(__va)); \ + pte_t *__ptep = lookup_address((unsigned long)(va)); \ + BUG_ON(!__ptep || !pte_present(*__ptep)); \ + __ptep; \ }) -#define arbitrary_virt_to_machine(__va) \ -({ \ - maddr_t m = (maddr_t)pte_mfn(*virt_to_ptep(__va)) << PAGE_SHIFT;\ - m | ((unsigned long)(__va) & (PAGE_SIZE-1)); \ -}) +#define arbitrary_virt_to_machine(va) \ + (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ + | ((unsigned long)(va) & (PAGE_SIZE - 1))) #endif /* !__ASSEMBLY__ */ diff -r c3f9cc7789af -r c6e36a53cf05 include/asm-x86_64/mach-xen/asm/pgtable.h --- a/include/asm-x86_64/mach-xen/asm/pgtable.h Thu May 15 10:03:29 2008 +0100 +++ b/include/asm-x86_64/mach-xen/asm/pgtable.h Thu May 15 15:14:31 2008 +0100 @@ -18,19 +18,18 @@ extern pud_t level3_user_pgt[512]; extern void xen_init_pt(void); -#define virt_to_ptep(__va) \ +extern pte_t *lookup_address(unsigned long address); + +#define virt_to_ptep(va) \ ({ \ - pgd_t *__pgd = pgd_offset_k((unsigned long)(__va)); \ - pud_t *__pud = pud_offset(__pgd, (unsigned long)(__va)); \ - pmd_t *__pmd = pmd_offset(__pud, (unsigned long)(__va)); \ - pte_offset_kernel(__pmd, (unsigned long)(__va)); \ + pte_t *__ptep = lookup_address((unsigned long)(va)); \ + BUG_ON(!__ptep || !pte_present(*__ptep)); \ + __ptep; \ }) -#define arbitrary_virt_to_machine(__va) \ -({ \ - maddr_t m = (maddr_t)pte_mfn(*virt_to_ptep(__va)) << PAGE_SHIFT;\ - m | ((unsigned long)(__va) & (PAGE_SIZE-1)); \ -}) +#define arbitrary_virt_to_machine(va) \ + (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ + | ((unsigned long)(va) & (PAGE_SIZE - 1))) #endif extern pud_t level3_kernel_pgt[512]; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |