aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-avr32/pgtable.h
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-01-14 16:15:05 -0500
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-07-02 05:01:28 -0400
commitcfd23e93a0289cf6711fd3877c5226658d87240a (patch)
tree1030f0ee5ccd59d1d80b2b5fdc892987f90fac8e /include/asm-avr32/pgtable.h
parentebe74597a55fef00edc80a414ef5c6477d035e0a (diff)
avr32: Store virtual addresses in the PGD
Instead of storing physical addresses along with page flags in the PGD, store virtual addresses and use NULL to indicate a not present second-level page table. A non-page-aligned page table indicates a bad PMD. This simplifies the TLB miss handler since it no longer has to check the Present bit and no longer has to convert the PGD entry from physical to virtual address. Instead, it has to check for a NULL entry, which is slightly cheaper than either. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'include/asm-avr32/pgtable.h')
-rw-r--r--include/asm-avr32/pgtable.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h
index c0e5e29417df..fecdda16f444 100644
--- a/include/asm-avr32/pgtable.h
+++ b/include/asm-avr32/pgtable.h
@@ -129,13 +129,6 @@ extern struct page *empty_zero_page;
129 129
130#define _PAGE_FLAGS_CACHE_MASK (_PAGE_CACHABLE | _PAGE_BUFFER | _PAGE_WT) 130#define _PAGE_FLAGS_CACHE_MASK (_PAGE_CACHABLE | _PAGE_BUFFER | _PAGE_WT)
131 131
132/* TODO: Check for saneness */
133/* User-mode page table flags (to be set in a pgd or pmd entry) */
134#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_TYPE_SMALL | _PAGE_RW \
135 | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
136/* Kernel-mode page table flags */
137#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_TYPE_SMALL | _PAGE_RW \
138 | _PAGE_ACCESSED | _PAGE_DIRTY)
139/* Flags that may be modified by software */ 132/* Flags that may be modified by software */
140#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY \ 133#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY \
141 | _PAGE_FLAGS_CACHE_MASK) 134 | _PAGE_FLAGS_CACHE_MASK)
@@ -262,10 +255,14 @@ static inline pte_t pte_mkspecial(pte_t pte)
262} 255}
263 256
264#define pmd_none(x) (!pmd_val(x)) 257#define pmd_none(x) (!pmd_val(x))
265#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) 258#define pmd_present(x) (pmd_val(x))
266#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) 259
267#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) \ 260static inline void pmd_clear(pmd_t *pmdp)
268 != _KERNPG_TABLE) 261{
262 set_pmd(pmdp, __pmd(0));
263}
264
265#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
269 266
270/* 267/*
271 * Permanent address of a page. We don't support highmem, so this is 268 * Permanent address of a page. We don't support highmem, so this is
@@ -303,19 +300,16 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
303 300
304#define page_pte(page) page_pte_prot(page, __pgprot(0)) 301#define page_pte(page) page_pte_prot(page, __pgprot(0))
305 302
306#define pmd_page_vaddr(pmd) \ 303#define pmd_page_vaddr(pmd) pmd_val(pmd)
307 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 304#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
308
309#define pmd_page(pmd) (phys_to_page(pmd_val(pmd)))
310 305
311/* to find an entry in a page-table-directory. */ 306/* to find an entry in a page-table-directory. */
312#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 307#define pgd_index(address) (((address) >> PGDIR_SHIFT) \
313#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) 308 & (PTRS_PER_PGD - 1))
314#define pgd_offset_current(address) \ 309#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
315 ((pgd_t *)__mfsr(SYSREG_PTBR) + pgd_index(address))
316 310
317/* to find an entry in a kernel page-table-directory */ 311/* to find an entry in a kernel page-table-directory */
318#define pgd_offset_k(address) pgd_offset(&init_mm, address) 312#define pgd_offset_k(address) pgd_offset(&init_mm, address)
319 313
320/* Find an entry in the third-level page table.. */ 314/* Find an entry in the third-level page table.. */
321#define pte_index(address) \ 315#define pte_index(address) \