diff options
author | Dave McCracken <dmccr@us.ibm.com> | 2006-09-26 02:31:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:51 -0400 |
commit | 46a82b2d5591335277ed2930611f6acb4ce654ed (patch) | |
tree | e90bc1843701af2012bae92564f7109027a8244f /include/asm-x86_64/pgtable.h | |
parent | d2e7b7d0aa021847c59f882b066e7d3812902870 (diff) |
[PATCH] Standardize pxx_page macros
One of the changes necessary for shared page tables is to standardize the
pxx_page macros. pte_page and pmd_page have always returned the struct
page associated with their entry, while pte_page_kernel and pmd_page_kernel
have returned the kernel virtual address. pud_page and pgd_page, on the
other hand, return the kernel virtual address.
Shared page tables needs pud_page and pgd_page to return the actual page
structures. There are very few actual users of these functions, so it is
simple to standardize their usage.
Since this is basic cleanup, I am submitting these changes as a standalone
patch. Per Hugh Dickins' comments about it, I am also changing the
pxx_page_kernel macros to pxx_page_vaddr to clarify their meaning.
Signed-off-by: Dave McCracken <dmccr@us.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-x86_64/pgtable.h')
-rw-r--r-- | include/asm-x86_64/pgtable.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index a31ab4e68a9b..51eba2395171 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
@@ -101,9 +101,6 @@ static inline void pgd_clear (pgd_t * pgd) | |||
101 | set_pgd(pgd, __pgd(0)); | 101 | set_pgd(pgd, __pgd(0)); |
102 | } | 102 | } |
103 | 103 | ||
104 | #define pud_page(pud) \ | ||
105 | ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) | ||
106 | |||
107 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) | 104 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) |
108 | 105 | ||
109 | struct mm_struct; | 106 | struct mm_struct; |
@@ -326,7 +323,8 @@ static inline int pmd_large(pmd_t pte) { | |||
326 | /* | 323 | /* |
327 | * Level 4 access. | 324 | * Level 4 access. |
328 | */ | 325 | */ |
329 | #define pgd_page(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK)) | 326 | #define pgd_page_vaddr(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK)) |
327 | #define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT)) | ||
330 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 328 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
331 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) | 329 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) |
332 | #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) | 330 | #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) |
@@ -335,16 +333,18 @@ static inline int pmd_large(pmd_t pte) { | |||
335 | 333 | ||
336 | /* PUD - Level3 access */ | 334 | /* PUD - Level3 access */ |
337 | /* to find an entry in a page-table-directory. */ | 335 | /* to find an entry in a page-table-directory. */ |
336 | #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) | ||
337 | #define pud_page(pud) (pfn_to_page(pud_val(pud) >> PAGE_SHIFT)) | ||
338 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) | 338 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) |
339 | #define pud_offset(pgd, address) ((pud_t *) pgd_page(*(pgd)) + pud_index(address)) | 339 | #define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) |
340 | #define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) | 340 | #define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) |
341 | 341 | ||
342 | /* PMD - Level 2 access */ | 342 | /* PMD - Level 2 access */ |
343 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) | 343 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) |
344 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 344 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
345 | 345 | ||
346 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | 346 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) |
347 | #define pmd_offset(dir, address) ((pmd_t *) pud_page(*(dir)) + \ | 347 | #define pmd_offset(dir, address) ((pmd_t *) pud_page_vaddr(*(dir)) + \ |
348 | pmd_index(address)) | 348 | pmd_index(address)) |
349 | #define pmd_none(x) (!pmd_val(x)) | 349 | #define pmd_none(x) (!pmd_val(x)) |
350 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) | 350 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) |
@@ -382,7 +382,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
382 | 382 | ||
383 | #define pte_index(address) \ | 383 | #define pte_index(address) \ |
384 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 384 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
385 | #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ | 385 | #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \ |
386 | pte_index(address)) | 386 | pte_index(address)) |
387 | 387 | ||
388 | /* x86-64 always has all page tables mapped. */ | 388 | /* x86-64 always has all page tables mapped. */ |