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-ia64 | |
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-ia64')
-rw-r--r-- | include/asm-ia64/pgtable.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h index 228981cadf8f..553182747722 100644 --- a/include/asm-ia64/pgtable.h +++ b/include/asm-ia64/pgtable.h | |||
@@ -275,21 +275,23 @@ ia64_phys_addr_valid (unsigned long addr) | |||
275 | #define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd))) | 275 | #define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd))) |
276 | #define pmd_present(pmd) (pmd_val(pmd) != 0UL) | 276 | #define pmd_present(pmd) (pmd_val(pmd) != 0UL) |
277 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) | 277 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) |
278 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK)) | 278 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK)) |
279 | #define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET)) | 279 | #define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET)) |
280 | 280 | ||
281 | #define pud_none(pud) (!pud_val(pud)) | 281 | #define pud_none(pud) (!pud_val(pud)) |
282 | #define pud_bad(pud) (!ia64_phys_addr_valid(pud_val(pud))) | 282 | #define pud_bad(pud) (!ia64_phys_addr_valid(pud_val(pud))) |
283 | #define pud_present(pud) (pud_val(pud) != 0UL) | 283 | #define pud_present(pud) (pud_val(pud) != 0UL) |
284 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) | 284 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) |
285 | #define pud_page(pud) ((unsigned long) __va(pud_val(pud) & _PFN_MASK)) | 285 | #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & _PFN_MASK)) |
286 | #define pud_page(pud) virt_to_page((pud_val(pud) + PAGE_OFFSET)) | ||
286 | 287 | ||
287 | #ifdef CONFIG_PGTABLE_4 | 288 | #ifdef CONFIG_PGTABLE_4 |
288 | #define pgd_none(pgd) (!pgd_val(pgd)) | 289 | #define pgd_none(pgd) (!pgd_val(pgd)) |
289 | #define pgd_bad(pgd) (!ia64_phys_addr_valid(pgd_val(pgd))) | 290 | #define pgd_bad(pgd) (!ia64_phys_addr_valid(pgd_val(pgd))) |
290 | #define pgd_present(pgd) (pgd_val(pgd) != 0UL) | 291 | #define pgd_present(pgd) (pgd_val(pgd) != 0UL) |
291 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) | 292 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) |
292 | #define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & _PFN_MASK)) | 293 | #define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_val(pgd) & _PFN_MASK)) |
294 | #define pgd_page(pgd) virt_to_page((pgd_val(pgd) + PAGE_OFFSET)) | ||
293 | #endif | 295 | #endif |
294 | 296 | ||
295 | /* | 297 | /* |
@@ -360,19 +362,19 @@ pgd_offset (struct mm_struct *mm, unsigned long address) | |||
360 | #ifdef CONFIG_PGTABLE_4 | 362 | #ifdef CONFIG_PGTABLE_4 |
361 | /* Find an entry in the second-level page table.. */ | 363 | /* Find an entry in the second-level page table.. */ |
362 | #define pud_offset(dir,addr) \ | 364 | #define pud_offset(dir,addr) \ |
363 | ((pud_t *) pgd_page(*(dir)) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) | 365 | ((pud_t *) pgd_page_vaddr(*(dir)) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) |
364 | #endif | 366 | #endif |
365 | 367 | ||
366 | /* Find an entry in the third-level page table.. */ | 368 | /* Find an entry in the third-level page table.. */ |
367 | #define pmd_offset(dir,addr) \ | 369 | #define pmd_offset(dir,addr) \ |
368 | ((pmd_t *) pud_page(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) | 370 | ((pmd_t *) pud_page_vaddr(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) |
369 | 371 | ||
370 | /* | 372 | /* |
371 | * Find an entry in the third-level page table. This looks more complicated than it | 373 | * Find an entry in the third-level page table. This looks more complicated than it |
372 | * should be because some platforms place page tables in high memory. | 374 | * should be because some platforms place page tables in high memory. |
373 | */ | 375 | */ |
374 | #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 376 | #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
375 | #define pte_offset_kernel(dir,addr) ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr)) | 377 | #define pte_offset_kernel(dir,addr) ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) |
376 | #define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr) | 378 | #define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr) |
377 | #define pte_offset_map_nested(dir,addr) pte_offset_map(dir, addr) | 379 | #define pte_offset_map_nested(dir,addr) pte_offset_map(dir, addr) |
378 | #define pte_unmap(pte) do { } while (0) | 380 | #define pte_unmap(pte) do { } while (0) |