aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/pgtable-64.h
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /arch/mips/include/asm/pgtable-64.h
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/mips/include/asm/pgtable-64.h')
-rw-r--r--arch/mips/include/asm/pgtable-64.h53
1 files changed, 46 insertions, 7 deletions
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index 9cd508993956..1be4b0fa30da 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -16,7 +16,11 @@
16#include <asm/cachectl.h> 16#include <asm/cachectl.h>
17#include <asm/fixmap.h> 17#include <asm/fixmap.h>
18 18
19#ifdef CONFIG_PAGE_SIZE_64KB
20#include <asm-generic/pgtable-nopmd.h>
21#else
19#include <asm-generic/pgtable-nopud.h> 22#include <asm-generic/pgtable-nopud.h>
23#endif
20 24
21/* 25/*
22 * Each address space has 2 4K pages as its page directory, giving 1024 26 * Each address space has 2 4K pages as its page directory, giving 1024
@@ -37,13 +41,20 @@
37 * fault address - VMALLOC_START. 41 * fault address - VMALLOC_START.
38 */ 42 */
39 43
44
45/* PGDIR_SHIFT determines what a third-level page table entry can map */
46#ifdef __PAGETABLE_PMD_FOLDED
47#define PGDIR_SHIFT (PAGE_SHIFT + PAGE_SHIFT + PTE_ORDER - 3)
48#else
49
40/* PMD_SHIFT determines the size of the area a second-level page table can map */ 50/* PMD_SHIFT determines the size of the area a second-level page table can map */
41#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3)) 51#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
42#define PMD_SIZE (1UL << PMD_SHIFT) 52#define PMD_SIZE (1UL << PMD_SHIFT)
43#define PMD_MASK (~(PMD_SIZE-1)) 53#define PMD_MASK (~(PMD_SIZE-1))
44 54
45/* PGDIR_SHIFT determines what a third-level page table entry can map */ 55
46#define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3)) 56#define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3))
57#endif
47#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 58#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
48#define PGDIR_MASK (~(PGDIR_SIZE-1)) 59#define PGDIR_MASK (~(PGDIR_SIZE-1))
49 60
@@ -92,12 +103,14 @@
92#ifdef CONFIG_PAGE_SIZE_64KB 103#ifdef CONFIG_PAGE_SIZE_64KB
93#define PGD_ORDER 0 104#define PGD_ORDER 0
94#define PUD_ORDER aieeee_attempt_to_allocate_pud 105#define PUD_ORDER aieeee_attempt_to_allocate_pud
95#define PMD_ORDER 0 106#define PMD_ORDER aieeee_attempt_to_allocate_pmd
96#define PTE_ORDER 0 107#define PTE_ORDER 0
97#endif 108#endif
98 109
99#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) 110#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
111#ifndef __PAGETABLE_PMD_FOLDED
100#define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t)) 112#define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t))
113#endif
101#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) 114#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
102 115
103#if PGDIR_SIZE >= TASK_SIZE 116#if PGDIR_SIZE >= TASK_SIZE
@@ -107,10 +120,17 @@
107#endif 120#endif
108#define FIRST_USER_ADDRESS 0UL 121#define FIRST_USER_ADDRESS 0UL
109 122
110#define VMALLOC_START MAP_BASE 123/*
124 * TLB refill handlers also map the vmalloc area into xuseg. Avoid
125 * the first couple of pages so NULL pointer dereferences will still
126 * reliably trap.
127 */
128#define VMALLOC_START (MAP_BASE + (2 * PAGE_SIZE))
111#define VMALLOC_END \ 129#define VMALLOC_END \
112 (VMALLOC_START + \ 130 (MAP_BASE + \
113 PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE - (1UL << 32)) 131 min(PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE, \
132 (1UL << cpu_vmbits)) - (1UL << 32))
133
114#if defined(CONFIG_MODULES) && defined(KBUILD_64BIT_SYM32) && \ 134#if defined(CONFIG_MODULES) && defined(KBUILD_64BIT_SYM32) && \
115 VMALLOC_START != CKSSEG 135 VMALLOC_START != CKSSEG
116/* Load modules into 32bit-compatible segment. */ 136/* Load modules into 32bit-compatible segment. */
@@ -120,15 +140,30 @@
120 140
121#define pte_ERROR(e) \ 141#define pte_ERROR(e) \
122 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) 142 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
143#ifndef __PAGETABLE_PMD_FOLDED
123#define pmd_ERROR(e) \ 144#define pmd_ERROR(e) \
124 printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e)) 145 printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
146#endif
125#define pgd_ERROR(e) \ 147#define pgd_ERROR(e) \
126 printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) 148 printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
127 149
128extern pte_t invalid_pte_table[PTRS_PER_PTE]; 150extern pte_t invalid_pte_table[PTRS_PER_PTE];
129extern pte_t empty_bad_page_table[PTRS_PER_PTE]; 151extern pte_t empty_bad_page_table[PTRS_PER_PTE];
152
153
154#ifndef __PAGETABLE_PMD_FOLDED
155/*
156 * For 3-level pagetables we defines these ourselves, for 2-level the
157 * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
158 */
159typedef struct { unsigned long pmd; } pmd_t;
160#define pmd_val(x) ((x).pmd)
161#define __pmd(x) ((pmd_t) { (x) } )
162
163
130extern pmd_t invalid_pmd_table[PTRS_PER_PMD]; 164extern pmd_t invalid_pmd_table[PTRS_PER_PMD];
131extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD]; 165extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD];
166#endif
132 167
133/* 168/*
134 * Empty pgd/pmd entries point to the invalid_pte_table. 169 * Empty pgd/pmd entries point to the invalid_pte_table.
@@ -149,6 +184,7 @@ static inline void pmd_clear(pmd_t *pmdp)
149{ 184{
150 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); 185 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
151} 186}
187#ifndef __PAGETABLE_PMD_FOLDED
152 188
153/* 189/*
154 * Empty pud entries point to the invalid_pmd_table. 190 * Empty pud entries point to the invalid_pmd_table.
@@ -172,6 +208,7 @@ static inline void pud_clear(pud_t *pudp)
172{ 208{
173 pud_val(*pudp) = ((unsigned long) invalid_pmd_table); 209 pud_val(*pudp) = ((unsigned long) invalid_pmd_table);
174} 210}
211#endif
175 212
176#define pte_page(x) pfn_to_page(pte_pfn(x)) 213#define pte_page(x) pfn_to_page(pte_pfn(x))
177 214
@@ -179,8 +216,8 @@ static inline void pud_clear(pud_t *pudp)
179#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2))) 216#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
180#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) 217#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
181#else 218#else
182#define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT)) 219#define pte_pfn(x) ((unsigned long)((x).pte >> _PFN_SHIFT))
183#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 220#define pfn_pte(pfn, prot) __pte(((pfn) << _PFN_SHIFT) | pgprot_val(prot))
184#endif 221#endif
185 222
186#define __pgd_offset(address) pgd_index(address) 223#define __pgd_offset(address) pgd_index(address)
@@ -196,6 +233,7 @@ static inline void pud_clear(pud_t *pudp)
196/* to find an entry in a page-table-directory */ 233/* to find an entry in a page-table-directory */
197#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) 234#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
198 235
236#ifndef __PAGETABLE_PMD_FOLDED
199static inline unsigned long pud_page_vaddr(pud_t pud) 237static inline unsigned long pud_page_vaddr(pud_t pud)
200{ 238{
201 return pud_val(pud); 239 return pud_val(pud);
@@ -208,6 +246,7 @@ static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
208{ 246{
209 return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address); 247 return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address);
210} 248}
249#endif
211 250
212/* Find an entry in the third-level page table.. */ 251/* Find an entry in the third-level page table.. */
213#define __pte_offset(address) \ 252#define __pte_offset(address) \