diff options
Diffstat (limited to 'include')
33 files changed, 109 insertions, 82 deletions
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h index 64d0ab98fcd8..8af56ce346ad 100644 --- a/include/asm-alpha/mmzone.h +++ b/include/asm-alpha/mmzone.h | |||
@@ -75,6 +75,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
75 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) | 75 | #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) |
76 | 76 | ||
77 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) | 77 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) |
78 | #define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> 32)) | ||
78 | #define pte_pfn(pte) (pte_val(pte) >> 32) | 79 | #define pte_pfn(pte) (pte_val(pte) >> 32) |
79 | 80 | ||
80 | #define mk_pte(page, pgprot) \ | 81 | #define mk_pte(page, pgprot) \ |
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 93eaa58b7961..49ac9bee7ced 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h | |||
@@ -230,16 +230,17 @@ extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) | |||
230 | 230 | ||
231 | 231 | ||
232 | extern inline unsigned long | 232 | extern inline unsigned long |
233 | pmd_page_kernel(pmd_t pmd) | 233 | pmd_page_vaddr(pmd_t pmd) |
234 | { | 234 | { |
235 | return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET; | 235 | return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET; |
236 | } | 236 | } |
237 | 237 | ||
238 | #ifndef CONFIG_DISCONTIGMEM | 238 | #ifndef CONFIG_DISCONTIGMEM |
239 | #define pmd_page(pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32)) | 239 | #define pmd_page(pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32)) |
240 | #define pgd_page(pgd) (mem_map + ((pgd_val(pgd) & _PFN_MASK) >> 32)) | ||
240 | #endif | 241 | #endif |
241 | 242 | ||
242 | extern inline unsigned long pgd_page(pgd_t pgd) | 243 | extern inline unsigned long pgd_page_vaddr(pgd_t pgd) |
243 | { return PAGE_OFFSET + ((pgd_val(pgd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } | 244 | { return PAGE_OFFSET + ((pgd_val(pgd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } |
244 | 245 | ||
245 | extern inline int pte_none(pte_t pte) { return !pte_val(pte); } | 246 | extern inline int pte_none(pte_t pte) { return !pte_val(pte); } |
@@ -293,13 +294,13 @@ extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; retu | |||
293 | /* Find an entry in the second-level page table.. */ | 294 | /* Find an entry in the second-level page table.. */ |
294 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | 295 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) |
295 | { | 296 | { |
296 | return (pmd_t *) pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1)); | 297 | return (pmd_t *) pgd_page_vaddr(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PAGE - 1)); |
297 | } | 298 | } |
298 | 299 | ||
299 | /* Find an entry in the third-level page table.. */ | 300 | /* Find an entry in the third-level page table.. */ |
300 | extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address) | 301 | extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address) |
301 | { | 302 | { |
302 | return (pte_t *) pmd_page_kernel(*dir) | 303 | return (pte_t *) pmd_page_vaddr(*dir) |
303 | + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); | 304 | + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); |
304 | } | 305 | } |
305 | 306 | ||
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h index 8d3919c6458c..4d10d319fa34 100644 --- a/include/asm-arm/pgtable.h +++ b/include/asm-arm/pgtable.h | |||
@@ -224,9 +224,9 @@ extern struct page *empty_zero_page; | |||
224 | #define pte_none(pte) (!pte_val(pte)) | 224 | #define pte_none(pte) (!pte_val(pte)) |
225 | #define pte_clear(mm,addr,ptep) set_pte_at((mm),(addr),(ptep), __pte(0)) | 225 | #define pte_clear(mm,addr,ptep) set_pte_at((mm),(addr),(ptep), __pte(0)) |
226 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) | 226 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) |
227 | #define pte_offset_kernel(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 227 | #define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
228 | #define pte_offset_map(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 228 | #define pte_offset_map(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
229 | #define pte_offset_map_nested(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 229 | #define pte_offset_map_nested(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
230 | #define pte_unmap(pte) do { } while (0) | 230 | #define pte_unmap(pte) do { } while (0) |
231 | #define pte_unmap_nested(pte) do { } while (0) | 231 | #define pte_unmap_nested(pte) do { } while (0) |
232 | 232 | ||
@@ -291,7 +291,7 @@ PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); | |||
291 | clean_pmd_entry(pmdp); \ | 291 | clean_pmd_entry(pmdp); \ |
292 | } while (0) | 292 | } while (0) |
293 | 293 | ||
294 | static inline pte_t *pmd_page_kernel(pmd_t pmd) | 294 | static inline pte_t *pmd_page_vaddr(pmd_t pmd) |
295 | { | 295 | { |
296 | unsigned long ptr; | 296 | unsigned long ptr; |
297 | 297 | ||
diff --git a/include/asm-arm26/pgtable.h b/include/asm-arm26/pgtable.h index 19ac9101a6bb..63a8881fae13 100644 --- a/include/asm-arm26/pgtable.h +++ b/include/asm-arm26/pgtable.h | |||
@@ -186,12 +186,12 @@ extern struct page *empty_zero_page; | |||
186 | * return a pointer to memory (no special alignment) | 186 | * return a pointer to memory (no special alignment) |
187 | */ | 187 | */ |
188 | #define pmd_page(pmd) ((struct page *)(pmd_val((pmd)) & ~_PMD_PRESENT)) | 188 | #define pmd_page(pmd) ((struct page *)(pmd_val((pmd)) & ~_PMD_PRESENT)) |
189 | #define pmd_page_kernel(pmd) ((pte_t *)(pmd_val((pmd)) & ~_PMD_PRESENT)) | 189 | #define pmd_page_vaddr(pmd) ((pte_t *)(pmd_val((pmd)) & ~_PMD_PRESENT)) |
190 | 190 | ||
191 | #define pte_offset_kernel(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 191 | #define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
192 | 192 | ||
193 | #define pte_offset_map(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 193 | #define pte_offset_map(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
194 | #define pte_offset_map_nested(dir,addr) (pmd_page_kernel(*(dir)) + __pte_index(addr)) | 194 | #define pte_offset_map_nested(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) |
195 | #define pte_unmap(pte) do { } while (0) | 195 | #define pte_unmap(pte) do { } while (0) |
196 | #define pte_unmap_nested(pte) do { } while (0) | 196 | #define pte_unmap_nested(pte) do { } while (0) |
197 | 197 | ||
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h index 5d76c1c0d6c9..c94a7107019c 100644 --- a/include/asm-cris/pgtable.h +++ b/include/asm-cris/pgtable.h | |||
@@ -253,7 +253,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | |||
253 | { pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } | 253 | { pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } |
254 | 254 | ||
255 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 255 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
256 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 256 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
257 | 257 | ||
258 | /* to find an entry in a page-table-directory. */ | 258 | /* to find an entry in a page-table-directory. */ |
259 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 259 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
@@ -271,7 +271,7 @@ static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) | |||
271 | #define __pte_offset(address) \ | 271 | #define __pte_offset(address) \ |
272 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 272 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
273 | #define pte_offset_kernel(dir, address) \ | 273 | #define pte_offset_kernel(dir, address) \ |
274 | ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) | 274 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) |
275 | #define pte_offset_map(dir, address) \ | 275 | #define pte_offset_map(dir, address) \ |
276 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | 276 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
277 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | 277 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) |
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index 7af7485e889e..2fb3c6f05e03 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h | |||
@@ -217,7 +217,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address) | |||
217 | } | 217 | } |
218 | 218 | ||
219 | #define pgd_page(pgd) (pud_page((pud_t){ pgd })) | 219 | #define pgd_page(pgd) (pud_page((pud_t){ pgd })) |
220 | #define pgd_page_kernel(pgd) (pud_page_kernel((pud_t){ pgd })) | 220 | #define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd })) |
221 | 221 | ||
222 | /* | 222 | /* |
223 | * allocating and freeing a pud is trivial: the 1-entry pud is | 223 | * allocating and freeing a pud is trivial: the 1-entry pud is |
@@ -246,7 +246,7 @@ static inline void pud_clear(pud_t *pud) { } | |||
246 | #define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval }) | 246 | #define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval }) |
247 | 247 | ||
248 | #define pud_page(pud) (pmd_page((pmd_t){ pud })) | 248 | #define pud_page(pud) (pmd_page((pmd_t){ pud })) |
249 | #define pud_page_kernel(pud) (pmd_page_kernel((pmd_t){ pud })) | 249 | #define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud })) |
250 | 250 | ||
251 | /* | 251 | /* |
252 | * (pmds are folded into pgds so this doesn't get actually called, | 252 | * (pmds are folded into pgds so this doesn't get actually called, |
@@ -362,7 +362,7 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address) | |||
362 | #define pmd_bad(x) (pmd_val(x) & xAMPRx_SS) | 362 | #define pmd_bad(x) (pmd_val(x) & xAMPRx_SS) |
363 | #define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0) | 363 | #define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0) |
364 | 364 | ||
365 | #define pmd_page_kernel(pmd) \ | 365 | #define pmd_page_vaddr(pmd) \ |
366 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 366 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
367 | 367 | ||
368 | #ifndef CONFIG_DISCONTIGMEM | 368 | #ifndef CONFIG_DISCONTIGMEM |
@@ -458,7 +458,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
458 | #define pte_index(address) \ | 458 | #define pte_index(address) \ |
459 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 459 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
460 | #define pte_offset_kernel(dir, address) \ | 460 | #define pte_offset_kernel(dir, address) \ |
461 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | 461 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) |
462 | 462 | ||
463 | #if defined(CONFIG_HIGHPTE) | 463 | #if defined(CONFIG_HIGHPTE) |
464 | #define pte_offset_map(dir, address) \ | 464 | #define pte_offset_map(dir, address) \ |
diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h index 68c6fea994d9..7b88d3931e34 100644 --- a/include/asm-generic/4level-fixup.h +++ b/include/asm-generic/4level-fixup.h | |||
@@ -21,6 +21,10 @@ | |||
21 | #define pud_present(pud) 1 | 21 | #define pud_present(pud) 1 |
22 | #define pud_ERROR(pud) do { } while (0) | 22 | #define pud_ERROR(pud) do { } while (0) |
23 | #define pud_clear(pud) pgd_clear(pud) | 23 | #define pud_clear(pud) pgd_clear(pud) |
24 | #define pud_val(pud) pgd_val(pud) | ||
25 | #define pud_populate(mm, pud, pmd) pgd_populate(mm, pud, pmd) | ||
26 | #define pud_page(pud) pgd_page(pud) | ||
27 | #define pud_page_vaddr(pud) pgd_page_vaddr(pud) | ||
24 | 28 | ||
25 | #undef pud_free_tlb | 29 | #undef pud_free_tlb |
26 | #define pud_free_tlb(tlb, x) do { } while (0) | 30 | #define pud_free_tlb(tlb, x) do { } while (0) |
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index c8d53ba20e19..29ff5d84d8c3 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h | |||
@@ -47,7 +47,7 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address) | |||
47 | #define __pmd(x) ((pmd_t) { __pud(x) } ) | 47 | #define __pmd(x) ((pmd_t) { __pud(x) } ) |
48 | 48 | ||
49 | #define pud_page(pud) (pmd_page((pmd_t){ pud })) | 49 | #define pud_page(pud) (pmd_page((pmd_t){ pud })) |
50 | #define pud_page_kernel(pud) (pmd_page_kernel((pmd_t){ pud })) | 50 | #define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud })) |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * allocating and freeing a pmd is trivial: the 1-entry pmd is | 53 | * allocating and freeing a pmd is trivial: the 1-entry pmd is |
diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index 82e29f0ce467..566464500558 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h | |||
@@ -44,7 +44,7 @@ static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address) | |||
44 | #define __pud(x) ((pud_t) { __pgd(x) } ) | 44 | #define __pud(x) ((pud_t) { __pgd(x) } ) |
45 | 45 | ||
46 | #define pgd_page(pgd) (pud_page((pud_t){ pgd })) | 46 | #define pgd_page(pgd) (pud_page((pud_t){ pgd })) |
47 | #define pgd_page_kernel(pgd) (pud_page_kernel((pud_t){ pgd })) | 47 | #define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd })) |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * allocating and freeing a pud is trivial: the 1-entry pud is | 50 | * allocating and freeing a pud is trivial: the 1-entry pud is |
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h index dccb1b3337ad..807ed9e366de 100644 --- a/include/asm-i386/pgtable-3level.h +++ b/include/asm-i386/pgtable-3level.h | |||
@@ -77,7 +77,7 @@ static inline void pud_clear (pud_t * pud) { } | |||
77 | #define pud_page(pud) \ | 77 | #define pud_page(pud) \ |
78 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) | 78 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) |
79 | 79 | ||
80 | #define pud_page_kernel(pud) \ | 80 | #define pud_page_vaddr(pud) \ |
81 | ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) | 81 | ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) |
82 | 82 | ||
83 | 83 | ||
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 09697fec3d2b..c04b3d0f484e 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h | |||
@@ -364,11 +364,11 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
364 | #define pte_index(address) \ | 364 | #define pte_index(address) \ |
365 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 365 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
366 | #define pte_offset_kernel(dir, address) \ | 366 | #define pte_offset_kernel(dir, address) \ |
367 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | 367 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) |
368 | 368 | ||
369 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 369 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
370 | 370 | ||
371 | #define pmd_page_kernel(pmd) \ | 371 | #define pmd_page_vaddr(pmd) \ |
372 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 372 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
373 | 373 | ||
374 | /* | 374 | /* |
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) |
diff --git a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h index be0f167e344a..6a674e3d37a2 100644 --- a/include/asm-m32r/pgtable-2level.h +++ b/include/asm-m32r/pgtable-2level.h | |||
@@ -52,9 +52,13 @@ static inline int pgd_present(pgd_t pgd) { return 1; } | |||
52 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | 52 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) |
53 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) | 53 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) |
54 | 54 | ||
55 | #define pgd_page(pgd) \ | 55 | #define pgd_page_vaddr(pgd) \ |
56 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) | 56 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) |
57 | 57 | ||
58 | #ifndef CONFIG_DISCONTIGMEM | ||
59 | #define pgd_page(pgd) (mem_map + ((pgd_val(pgd) >> PAGE_SHIFT) - PFN_BASE)) | ||
60 | #endif /* !CONFIG_DISCONTIGMEM */ | ||
61 | |||
58 | static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) | 62 | static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) |
59 | { | 63 | { |
60 | return (pmd_t *) dir; | 64 | return (pmd_t *) dir; |
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h index 1983b7f4527a..1c15ba7ce319 100644 --- a/include/asm-m32r/pgtable.h +++ b/include/asm-m32r/pgtable.h | |||
@@ -336,7 +336,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | |||
336 | pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK); | 336 | pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK); |
337 | } | 337 | } |
338 | 338 | ||
339 | #define pmd_page_kernel(pmd) \ | 339 | #define pmd_page_vaddr(pmd) \ |
340 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 340 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
341 | 341 | ||
342 | #ifndef CONFIG_DISCONTIGMEM | 342 | #ifndef CONFIG_DISCONTIGMEM |
@@ -358,7 +358,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | |||
358 | #define pte_index(address) \ | 358 | #define pte_index(address) \ |
359 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 359 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
360 | #define pte_offset_kernel(dir, address) \ | 360 | #define pte_offset_kernel(dir, address) \ |
361 | ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address)) | 361 | ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) |
362 | #define pte_offset_map(dir, address) \ | 362 | #define pte_offset_map(dir, address) \ |
363 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) | 363 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) |
364 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | 364 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) |
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h index 1ccc7338a54b..61e4406ed96a 100644 --- a/include/asm-m68k/motorola_pgtable.h +++ b/include/asm-m68k/motorola_pgtable.h | |||
@@ -150,6 +150,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) | |||
150 | #define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) | 150 | #define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) |
151 | #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) | 151 | #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) |
152 | #define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) | 152 | #define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) |
153 | #define pgd_page(pgd) (mem_map + ((unsigned long)(__va(pgd_val(pgd)) - PAGE_OFFSET) >> PAGE_SHIFT)) | ||
153 | 154 | ||
154 | #define pte_ERROR(e) \ | 155 | #define pte_ERROR(e) \ |
155 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | 156 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) |
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h index 4b26d8528133..d20f2e9b28be 100644 --- a/include/asm-mips/pgtable-32.h +++ b/include/asm-mips/pgtable-32.h | |||
@@ -156,9 +156,9 @@ pfn_pte(unsigned long pfn, pgprot_t prot) | |||
156 | #define __pte_offset(address) \ | 156 | #define __pte_offset(address) \ |
157 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 157 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
158 | #define pte_offset(dir, address) \ | 158 | #define pte_offset(dir, address) \ |
159 | ((pte_t *) (pmd_page_kernel(*dir)) + __pte_offset(address)) | 159 | ((pte_t *) (pmd_page_vaddr(*dir)) + __pte_offset(address)) |
160 | #define pte_offset_kernel(dir, address) \ | 160 | #define pte_offset_kernel(dir, address) \ |
161 | ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) | 161 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) |
162 | 162 | ||
163 | #define pte_offset_map(dir, address) \ | 163 | #define pte_offset_map(dir, address) \ |
164 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | 164 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h index e3db93212eab..c59a1e21f5b0 100644 --- a/include/asm-mips/pgtable-64.h +++ b/include/asm-mips/pgtable-64.h | |||
@@ -178,24 +178,26 @@ static inline void pud_clear(pud_t *pudp) | |||
178 | /* to find an entry in a page-table-directory */ | 178 | /* to find an entry in a page-table-directory */ |
179 | #define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) | 179 | #define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) |
180 | 180 | ||
181 | static inline unsigned long pud_page(pud_t pud) | 181 | static inline unsigned long pud_page_vaddr(pud_t pud) |
182 | { | 182 | { |
183 | return pud_val(pud); | 183 | return pud_val(pud); |
184 | } | 184 | } |
185 | #define pud_phys(pud) (pud_val(pud) - PAGE_OFFSET) | ||
186 | #define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT)) | ||
185 | 187 | ||
186 | /* Find an entry in the second-level page table.. */ | 188 | /* Find an entry in the second-level page table.. */ |
187 | static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address) | 189 | static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address) |
188 | { | 190 | { |
189 | return (pmd_t *) pud_page(*pud) + pmd_index(address); | 191 | return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address); |
190 | } | 192 | } |
191 | 193 | ||
192 | /* Find an entry in the third-level page table.. */ | 194 | /* Find an entry in the third-level page table.. */ |
193 | #define __pte_offset(address) \ | 195 | #define __pte_offset(address) \ |
194 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 196 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
195 | #define pte_offset(dir, address) \ | 197 | #define pte_offset(dir, address) \ |
196 | ((pte_t *) (pmd_page_kernel(*dir)) + __pte_offset(address)) | 198 | ((pte_t *) (pmd_page_vaddr(*dir)) + __pte_offset(address)) |
197 | #define pte_offset_kernel(dir, address) \ | 199 | #define pte_offset_kernel(dir, address) \ |
198 | ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) | 200 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) |
199 | #define pte_offset_map(dir, address) \ | 201 | #define pte_offset_map(dir, address) \ |
200 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | 202 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
201 | #define pte_offset_map_nested(dir, address) \ | 203 | #define pte_offset_map_nested(dir, address) \ |
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index a36ca1be17f2..1ca4d1e185c7 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
@@ -87,7 +87,7 @@ extern void paging_init(void); | |||
87 | */ | 87 | */ |
88 | #define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) | 88 | #define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) |
89 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) | 89 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) |
90 | #define pmd_page_kernel(pmd) pmd_val(pmd) | 90 | #define pmd_page_vaddr(pmd) pmd_val(pmd) |
91 | 91 | ||
92 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 92 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
93 | 93 | ||
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h index 5066c54dae0a..c0b61e0d1497 100644 --- a/include/asm-parisc/pgtable.h +++ b/include/asm-parisc/pgtable.h | |||
@@ -303,7 +303,8 @@ static inline void pmd_clear(pmd_t *pmd) { | |||
303 | 303 | ||
304 | 304 | ||
305 | #if PT_NLEVELS == 3 | 305 | #if PT_NLEVELS == 3 |
306 | #define pgd_page(pgd) ((unsigned long) __va(pgd_address(pgd))) | 306 | #define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_address(pgd))) |
307 | #define pgd_page(pgd) virt_to_page((void *)pgd_page_vaddr(pgd)) | ||
307 | 308 | ||
308 | /* For 64 bit we have three level tables */ | 309 | /* For 64 bit we have three level tables */ |
309 | 310 | ||
@@ -382,7 +383,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
382 | 383 | ||
383 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) | 384 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) |
384 | 385 | ||
385 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_address(pmd))) | 386 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_address(pmd))) |
386 | 387 | ||
387 | #define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd))) | 388 | #define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd))) |
388 | #define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) | 389 | #define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) |
@@ -400,7 +401,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
400 | 401 | ||
401 | #if PT_NLEVELS == 3 | 402 | #if PT_NLEVELS == 3 |
402 | #define pmd_offset(dir,address) \ | 403 | #define pmd_offset(dir,address) \ |
403 | ((pmd_t *) pgd_page(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1))) | 404 | ((pmd_t *) pgd_page_vaddr(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1))) |
404 | #else | 405 | #else |
405 | #define pmd_offset(dir,addr) ((pmd_t *) dir) | 406 | #define pmd_offset(dir,addr) ((pmd_t *) dir) |
406 | #endif | 407 | #endif |
@@ -408,7 +409,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
408 | /* Find an entry in the third-level page table.. */ | 409 | /* Find an entry in the third-level page table.. */ |
409 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) | 410 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) |
410 | #define pte_offset_kernel(pmd, address) \ | 411 | #define pte_offset_kernel(pmd, address) \ |
411 | ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address)) | 412 | ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address)) |
412 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) | 413 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) |
413 | #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) | 414 | #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) |
414 | #define pte_unmap(pte) do { } while (0) | 415 | #define pte_unmap(pte) do { } while (0) |
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h index e7036155672e..345d9b07b3e2 100644 --- a/include/asm-powerpc/pgtable-4k.h +++ b/include/asm-powerpc/pgtable-4k.h | |||
@@ -88,10 +88,11 @@ | |||
88 | #define pgd_bad(pgd) (pgd_val(pgd) == 0) | 88 | #define pgd_bad(pgd) (pgd_val(pgd) == 0) |
89 | #define pgd_present(pgd) (pgd_val(pgd) != 0) | 89 | #define pgd_present(pgd) (pgd_val(pgd) != 0) |
90 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) | 90 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) |
91 | #define pgd_page(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) | 91 | #define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) |
92 | #define pgd_page(pgd) virt_to_page(pgd_page_vaddr(pgd)) | ||
92 | 93 | ||
93 | #define pud_offset(pgdp, addr) \ | 94 | #define pud_offset(pgdp, addr) \ |
94 | (((pud_t *) pgd_page(*(pgdp))) + \ | 95 | (((pud_t *) pgd_page_vaddr(*(pgdp))) + \ |
95 | (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) | 96 | (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) |
96 | 97 | ||
97 | #define pud_ERROR(e) \ | 98 | #define pud_ERROR(e) \ |
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h index 8dbf5ad8150f..10f52743f4ff 100644 --- a/include/asm-powerpc/pgtable.h +++ b/include/asm-powerpc/pgtable.h | |||
@@ -196,8 +196,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
196 | || (pmd_val(pmd) & PMD_BAD_BITS)) | 196 | || (pmd_val(pmd) & PMD_BAD_BITS)) |
197 | #define pmd_present(pmd) (pmd_val(pmd) != 0) | 197 | #define pmd_present(pmd) (pmd_val(pmd) != 0) |
198 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) | 198 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) |
199 | #define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) | 199 | #define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) |
200 | #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) | 200 | #define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd)) |
201 | 201 | ||
202 | #define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) | 202 | #define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) |
203 | #define pud_none(pud) (!pud_val(pud)) | 203 | #define pud_none(pud) (!pud_val(pud)) |
@@ -205,7 +205,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
205 | || (pud_val(pud) & PUD_BAD_BITS)) | 205 | || (pud_val(pud) & PUD_BAD_BITS)) |
206 | #define pud_present(pud) (pud_val(pud) != 0) | 206 | #define pud_present(pud) (pud_val(pud) != 0) |
207 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0) | 207 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0) |
208 | #define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS) | 208 | #define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS) |
209 | #define pud_page(pud) virt_to_page(pud_page_vaddr(pud)) | ||
209 | 210 | ||
210 | #define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) | 211 | #define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) |
211 | 212 | ||
@@ -219,10 +220,10 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
219 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | 220 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) |
220 | 221 | ||
221 | #define pmd_offset(pudp,addr) \ | 222 | #define pmd_offset(pudp,addr) \ |
222 | (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) | 223 | (((pmd_t *) pud_page_vaddr(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) |
223 | 224 | ||
224 | #define pte_offset_kernel(dir,addr) \ | 225 | #define pte_offset_kernel(dir,addr) \ |
225 | (((pte_t *) pmd_page_kernel(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) | 226 | (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) |
226 | 227 | ||
227 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) | 228 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) |
228 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) | 229 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) |
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index 51fa7c662917..b1fdbf40dba2 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h | |||
@@ -526,7 +526,7 @@ static inline int pgd_bad(pgd_t pgd) { return 0; } | |||
526 | static inline int pgd_present(pgd_t pgd) { return 1; } | 526 | static inline int pgd_present(pgd_t pgd) { return 1; } |
527 | #define pgd_clear(xp) do { } while (0) | 527 | #define pgd_clear(xp) do { } while (0) |
528 | 528 | ||
529 | #define pgd_page(pgd) \ | 529 | #define pgd_page_vaddr(pgd) \ |
530 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) | 530 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) |
531 | 531 | ||
532 | /* | 532 | /* |
@@ -720,12 +720,12 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | |||
720 | * of the pte page. -- paulus | 720 | * of the pte page. -- paulus |
721 | */ | 721 | */ |
722 | #ifndef CONFIG_BOOKE | 722 | #ifndef CONFIG_BOOKE |
723 | #define pmd_page_kernel(pmd) \ | 723 | #define pmd_page_vaddr(pmd) \ |
724 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 724 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
725 | #define pmd_page(pmd) \ | 725 | #define pmd_page(pmd) \ |
726 | (mem_map + (pmd_val(pmd) >> PAGE_SHIFT)) | 726 | (mem_map + (pmd_val(pmd) >> PAGE_SHIFT)) |
727 | #else | 727 | #else |
728 | #define pmd_page_kernel(pmd) \ | 728 | #define pmd_page_vaddr(pmd) \ |
729 | ((unsigned long) (pmd_val(pmd) & PAGE_MASK)) | 729 | ((unsigned long) (pmd_val(pmd) & PAGE_MASK)) |
730 | #define pmd_page(pmd) \ | 730 | #define pmd_page(pmd) \ |
731 | (mem_map + (__pa(pmd_val(pmd)) >> PAGE_SHIFT)) | 731 | (mem_map + (__pa(pmd_val(pmd)) >> PAGE_SHIFT)) |
@@ -748,7 +748,7 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
748 | #define pte_index(address) \ | 748 | #define pte_index(address) \ |
749 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 749 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
750 | #define pte_offset_kernel(dir, addr) \ | 750 | #define pte_offset_kernel(dir, addr) \ |
751 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr)) | 751 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) |
752 | #define pte_offset_map(dir, addr) \ | 752 | #define pte_offset_map(dir, addr) \ |
753 | ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) | 753 | ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) |
754 | #define pte_offset_map_nested(dir, addr) \ | 754 | #define pte_offset_map_nested(dir, addr) \ |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index 1a07028d575e..e965309fedac 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -664,11 +664,13 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) | |||
664 | #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) | 664 | #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) |
665 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 665 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
666 | 666 | ||
667 | #define pmd_page_kernel(pmd) (pmd_val(pmd) & PAGE_MASK) | 667 | #define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK) |
668 | 668 | ||
669 | #define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT)) | 669 | #define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT)) |
670 | 670 | ||
671 | #define pgd_page_kernel(pgd) (pgd_val(pgd) & PAGE_MASK) | 671 | #define pgd_page_vaddr(pgd) (pgd_val(pgd) & PAGE_MASK) |
672 | |||
673 | #define pgd_page(pgd) (mem_map+(pgd_val(pgd) >> PAGE_SHIFT)) | ||
672 | 674 | ||
673 | /* to find an entry in a page-table-directory */ | 675 | /* to find an entry in a page-table-directory */ |
674 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 676 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
@@ -690,14 +692,14 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
690 | /* Find an entry in the second-level page table.. */ | 692 | /* Find an entry in the second-level page table.. */ |
691 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | 693 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) |
692 | #define pmd_offset(dir,addr) \ | 694 | #define pmd_offset(dir,addr) \ |
693 | ((pmd_t *) pgd_page_kernel(*(dir)) + pmd_index(addr)) | 695 | ((pmd_t *) pgd_page_vaddr(*(dir)) + pmd_index(addr)) |
694 | 696 | ||
695 | #endif /* __s390x__ */ | 697 | #endif /* __s390x__ */ |
696 | 698 | ||
697 | /* Find an entry in the third-level page table.. */ | 699 | /* Find an entry in the third-level page table.. */ |
698 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) | 700 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) |
699 | #define pte_offset_kernel(pmd, address) \ | 701 | #define pte_offset_kernel(pmd, address) \ |
700 | ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address)) | 702 | ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address)) |
701 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) | 703 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) |
702 | #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) | 704 | #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) |
703 | #define pte_unmap(pte) do { } while (0) | 705 | #define pte_unmap(pte) do { } while (0) |
diff --git a/include/asm-sh/pgtable-2level.h b/include/asm-sh/pgtable-2level.h index b0528aa3cb1f..b525db6f61c6 100644 --- a/include/asm-sh/pgtable-2level.h +++ b/include/asm-sh/pgtable-2level.h | |||
@@ -50,9 +50,12 @@ static inline void pgd_clear (pgd_t * pgdp) { } | |||
50 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | 50 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) |
51 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) | 51 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) |
52 | 52 | ||
53 | #define pgd_page(pgd) \ | 53 | #define pgd_page_vaddr(pgd) \ |
54 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) | 54 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) |
55 | 55 | ||
56 | #define pgd_page(pgd) \ | ||
57 | (phys_to_page(pgd_val(pgd))) | ||
58 | |||
56 | static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | 59 | static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) |
57 | { | 60 | { |
58 | return (pmd_t *) dir; | 61 | return (pmd_t *) dir; |
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index dcd23a03683d..40d41a78041e 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h | |||
@@ -225,7 +225,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot) | |||
225 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 225 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
226 | { set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } | 226 | { set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } |
227 | 227 | ||
228 | #define pmd_page_kernel(pmd) \ | 228 | #define pmd_page_vaddr(pmd) \ |
229 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 229 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
230 | 230 | ||
231 | #define pmd_page(pmd) \ | 231 | #define pmd_page(pmd) \ |
@@ -242,7 +242,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
242 | #define pte_index(address) \ | 242 | #define pte_index(address) \ |
243 | ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 243 | ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
244 | #define pte_offset_kernel(dir, address) \ | 244 | #define pte_offset_kernel(dir, address) \ |
245 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | 245 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) |
246 | #define pte_offset_map(dir, address) pte_offset_kernel(dir, address) | 246 | #define pte_offset_map(dir, address) pte_offset_kernel(dir, address) |
247 | #define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) | 247 | #define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) |
248 | #define pte_unmap(pte) do { } while (0) | 248 | #define pte_unmap(pte) do { } while (0) |
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h index 54c7821893f5..6b97c4cb1d64 100644 --- a/include/asm-sh64/pgtable.h +++ b/include/asm-sh64/pgtable.h | |||
@@ -190,7 +190,9 @@ static inline int pgd_bad(pgd_t pgd) { return 0; } | |||
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | 192 | ||
193 | #define pgd_page(pgd_entry) ((unsigned long) (pgd_val(pgd_entry) & PAGE_MASK)) | 193 | #define pgd_page_vaddr(pgd_entry) ((unsigned long) (pgd_val(pgd_entry) & PAGE_MASK)) |
194 | #define pgd_page(pgd) (virt_to_page(pgd_val(pgd))) | ||
195 | |||
194 | 196 | ||
195 | /* | 197 | /* |
196 | * PMD defines. Middle level. | 198 | * PMD defines. Middle level. |
@@ -219,7 +221,7 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
219 | #define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY) | 221 | #define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY) |
220 | #define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | 222 | #define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) |
221 | 223 | ||
222 | #define pmd_page_kernel(pmd_entry) \ | 224 | #define pmd_page_vaddr(pmd_entry) \ |
223 | ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK)) | 225 | ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK)) |
224 | 226 | ||
225 | #define pmd_page(pmd) \ | 227 | #define pmd_page(pmd) \ |
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index 226c6475c9a2..4f0a5ba0d6a0 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h | |||
@@ -143,10 +143,10 @@ extern unsigned long empty_zero_page; | |||
143 | /* | 143 | /* |
144 | */ | 144 | */ |
145 | BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t) | 145 | BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t) |
146 | BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page, pgd_t) | 146 | BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t) |
147 | 147 | ||
148 | #define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) | 148 | #define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) |
149 | #define pgd_page(pgd) BTFIXUP_CALL(pgd_page)(pgd) | 149 | #define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd) |
150 | 150 | ||
151 | BTFIXUPDEF_SETHI(none_mask) | 151 | BTFIXUPDEF_SETHI(none_mask) |
152 | BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) | 152 | BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) |
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index ebfe395cfb87..b12be7a869f6 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h | |||
@@ -630,8 +630,9 @@ static inline unsigned long pte_present(pte_t pte) | |||
630 | #define __pmd_page(pmd) \ | 630 | #define __pmd_page(pmd) \ |
631 | ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL))) | 631 | ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL))) |
632 | #define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) | 632 | #define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) |
633 | #define pud_page(pud) \ | 633 | #define pud_page_vaddr(pud) \ |
634 | ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL))) | 634 | ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL))) |
635 | #define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud)) | ||
635 | #define pmd_none(pmd) (!pmd_val(pmd)) | 636 | #define pmd_none(pmd) (!pmd_val(pmd)) |
636 | #define pmd_bad(pmd) (0) | 637 | #define pmd_bad(pmd) (0) |
637 | #define pmd_present(pmd) (pmd_val(pmd) != 0U) | 638 | #define pmd_present(pmd) (pmd_val(pmd) != 0U) |
@@ -653,7 +654,7 @@ static inline unsigned long pte_present(pte_t pte) | |||
653 | 654 | ||
654 | /* Find an entry in the second-level page table.. */ | 655 | /* Find an entry in the second-level page table.. */ |
655 | #define pmd_offset(pudp, address) \ | 656 | #define pmd_offset(pudp, address) \ |
656 | ((pmd_t *) pud_page(*(pudp)) + \ | 657 | ((pmd_t *) pud_page_vaddr(*(pudp)) + \ |
657 | (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))) | 658 | (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))) |
658 | 659 | ||
659 | /* Find an entry in the third-level page table.. */ | 660 | /* Find an entry in the third-level page table.. */ |
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h index ffe017f6b64b..6050e0eb257e 100644 --- a/include/asm-um/pgtable-2level.h +++ b/include/asm-um/pgtable-2level.h | |||
@@ -41,7 +41,7 @@ static inline void pgd_mkuptodate(pgd_t pgd) { } | |||
41 | #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) | 41 | #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) |
42 | #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) | 42 | #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) |
43 | 43 | ||
44 | #define pmd_page_kernel(pmd) \ | 44 | #define pmd_page_vaddr(pmd) \ |
45 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 45 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
46 | 46 | ||
47 | /* | 47 | /* |
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h index 786c25727289..ca0c2a92a112 100644 --- a/include/asm-um/pgtable-3level.h +++ b/include/asm-um/pgtable-3level.h | |||
@@ -74,11 +74,12 @@ extern inline void pud_clear (pud_t *pud) | |||
74 | set_pud(pud, __pud(0)); | 74 | set_pud(pud, __pud(0)); |
75 | } | 75 | } |
76 | 76 | ||
77 | #define pud_page(pud) \ | 77 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) |
78 | #define pud_page_vaddr(pud) \ | ||
78 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) | 79 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) |
79 | 80 | ||
80 | /* Find an entry in the second-level page table.. */ | 81 | /* Find an entry in the second-level page table.. */ |
81 | #define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \ | 82 | #define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \ |
82 | pmd_index(address)) | 83 | pmd_index(address)) |
83 | 84 | ||
84 | static inline unsigned long pte_pfn(pte_t pte) | 85 | static inline unsigned long pte_pfn(pte_t pte) |
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h index ac64eb955868..4862daf8b906 100644 --- a/include/asm-um/pgtable.h +++ b/include/asm-um/pgtable.h | |||
@@ -349,7 +349,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
349 | return pte; | 349 | return pte; |
350 | } | 350 | } |
351 | 351 | ||
352 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 352 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
353 | 353 | ||
354 | /* | 354 | /* |
355 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] | 355 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] |
@@ -389,7 +389,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
389 | */ | 389 | */ |
390 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 390 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
391 | #define pte_offset_kernel(dir, address) \ | 391 | #define pte_offset_kernel(dir, address) \ |
392 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | 392 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) |
393 | #define pte_offset_map(dir, address) \ | 393 | #define pte_offset_map(dir, address) \ |
394 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) | 394 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) |
395 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | 395 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) |
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. */ |
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h index 7b15afb70c56..a47cc734c20c 100644 --- a/include/asm-xtensa/pgtable.h +++ b/include/asm-xtensa/pgtable.h | |||
@@ -218,7 +218,7 @@ extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)]; | |||
218 | /* | 218 | /* |
219 | * The pmd contains the kernel virtual address of the pte page. | 219 | * The pmd contains the kernel virtual address of the pte page. |
220 | */ | 220 | */ |
221 | #define pmd_page_kernel(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK)) | 221 | #define pmd_page_vaddr(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK)) |
222 | #define pmd_page(pmd) virt_to_page(pmd_val(pmd)) | 222 | #define pmd_page(pmd) virt_to_page(pmd_val(pmd)) |
223 | 223 | ||
224 | /* | 224 | /* |
@@ -349,7 +349,7 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | |||
349 | /* Find an entry in the third-level page table.. */ | 349 | /* Find an entry in the third-level page table.. */ |
350 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 350 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
351 | #define pte_offset_kernel(dir,addr) \ | 351 | #define pte_offset_kernel(dir,addr) \ |
352 | ((pte_t*) pmd_page_kernel(*(dir)) + pte_index(addr)) | 352 | ((pte_t*) pmd_page_vaddr(*(dir)) + pte_index(addr)) |
353 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) | 353 | #define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) |
354 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr)) | 354 | #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr)) |
355 | 355 | ||