aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/pgtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/pgtable.h')
-rw-r--r--include/asm-x86/pgtable.h72
1 files changed, 37 insertions, 35 deletions
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index 97c271b2910b..bcb5446a08d1 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -20,30 +20,25 @@
20#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ 20#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
21#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ 21#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */
22 22
23/* 23#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
24 * Note: we use _AC(1, L) instead of _AC(1, UL) so that we get a 24#define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW)
25 * sign-extended value on 32-bit with all 1's in the upper word, 25#define _PAGE_USER (_AT(pteval_t, 1) << _PAGE_BIT_USER)
26 * which preserves the upper pte values on 64-bit ptes: 26#define _PAGE_PWT (_AT(pteval_t, 1) << _PAGE_BIT_PWT)
27 */ 27#define _PAGE_PCD (_AT(pteval_t, 1) << _PAGE_BIT_PCD)
28#define _PAGE_PRESENT (_AC(1, L)<<_PAGE_BIT_PRESENT) 28#define _PAGE_ACCESSED (_AT(pteval_t, 1) << _PAGE_BIT_ACCESSED)
29#define _PAGE_RW (_AC(1, L)<<_PAGE_BIT_RW) 29#define _PAGE_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_DIRTY)
30#define _PAGE_USER (_AC(1, L)<<_PAGE_BIT_USER) 30#define _PAGE_PSE (_AT(pteval_t, 1) << _PAGE_BIT_PSE)
31#define _PAGE_PWT (_AC(1, L)<<_PAGE_BIT_PWT) 31#define _PAGE_GLOBAL (_AT(pteval_t, 1) << _PAGE_BIT_GLOBAL)
32#define _PAGE_PCD (_AC(1, L)<<_PAGE_BIT_PCD) 32#define _PAGE_UNUSED1 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED1)
33#define _PAGE_ACCESSED (_AC(1, L)<<_PAGE_BIT_ACCESSED) 33#define _PAGE_UNUSED2 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED2)
34#define _PAGE_DIRTY (_AC(1, L)<<_PAGE_BIT_DIRTY) 34#define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3)
35#define _PAGE_PSE (_AC(1, L)<<_PAGE_BIT_PSE) /* 2MB page */ 35#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT)
36#define _PAGE_GLOBAL (_AC(1, L)<<_PAGE_BIT_GLOBAL) /* Global TLB entry */ 36#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
37#define _PAGE_UNUSED1 (_AC(1, L)<<_PAGE_BIT_UNUSED1)
38#define _PAGE_UNUSED2 (_AC(1, L)<<_PAGE_BIT_UNUSED2)
39#define _PAGE_UNUSED3 (_AC(1, L)<<_PAGE_BIT_UNUSED3)
40#define _PAGE_PAT (_AC(1, L)<<_PAGE_BIT_PAT)
41#define _PAGE_PAT_LARGE (_AC(1, L)<<_PAGE_BIT_PAT_LARGE)
42 37
43#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 38#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
44#define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX) 39#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
45#else 40#else
46#define _PAGE_NX 0 41#define _PAGE_NX (_AT(pteval_t, 0))
47#endif 42#endif
48 43
49/* If _PAGE_PRESENT is clear, we use these: */ 44/* If _PAGE_PRESENT is clear, we use these: */
@@ -164,37 +159,37 @@ extern struct list_head pgd_list;
164 */ 159 */
165static inline int pte_dirty(pte_t pte) 160static inline int pte_dirty(pte_t pte)
166{ 161{
167 return pte_val(pte) & _PAGE_DIRTY; 162 return pte_flags(pte) & _PAGE_DIRTY;
168} 163}
169 164
170static inline int pte_young(pte_t pte) 165static inline int pte_young(pte_t pte)
171{ 166{
172 return pte_val(pte) & _PAGE_ACCESSED; 167 return pte_flags(pte) & _PAGE_ACCESSED;
173} 168}
174 169
175static inline int pte_write(pte_t pte) 170static inline int pte_write(pte_t pte)
176{ 171{
177 return pte_val(pte) & _PAGE_RW; 172 return pte_flags(pte) & _PAGE_RW;
178} 173}
179 174
180static inline int pte_file(pte_t pte) 175static inline int pte_file(pte_t pte)
181{ 176{
182 return pte_val(pte) & _PAGE_FILE; 177 return pte_flags(pte) & _PAGE_FILE;
183} 178}
184 179
185static inline int pte_huge(pte_t pte) 180static inline int pte_huge(pte_t pte)
186{ 181{
187 return pte_val(pte) & _PAGE_PSE; 182 return pte_flags(pte) & _PAGE_PSE;
188} 183}
189 184
190static inline int pte_global(pte_t pte) 185static inline int pte_global(pte_t pte)
191{ 186{
192 return pte_val(pte) & _PAGE_GLOBAL; 187 return pte_flags(pte) & _PAGE_GLOBAL;
193} 188}
194 189
195static inline int pte_exec(pte_t pte) 190static inline int pte_exec(pte_t pte)
196{ 191{
197 return !(pte_val(pte) & _PAGE_NX); 192 return !(pte_flags(pte) & _PAGE_NX);
198} 193}
199 194
200static inline int pte_special(pte_t pte) 195static inline int pte_special(pte_t pte)
@@ -210,22 +205,22 @@ static inline int pmd_large(pmd_t pte)
210 205
211static inline pte_t pte_mkclean(pte_t pte) 206static inline pte_t pte_mkclean(pte_t pte)
212{ 207{
213 return __pte(pte_val(pte) & ~(pteval_t)_PAGE_DIRTY); 208 return __pte(pte_val(pte) & ~_PAGE_DIRTY);
214} 209}
215 210
216static inline pte_t pte_mkold(pte_t pte) 211static inline pte_t pte_mkold(pte_t pte)
217{ 212{
218 return __pte(pte_val(pte) & ~(pteval_t)_PAGE_ACCESSED); 213 return __pte(pte_val(pte) & ~_PAGE_ACCESSED);
219} 214}
220 215
221static inline pte_t pte_wrprotect(pte_t pte) 216static inline pte_t pte_wrprotect(pte_t pte)
222{ 217{
223 return __pte(pte_val(pte) & ~(pteval_t)_PAGE_RW); 218 return __pte(pte_val(pte) & ~_PAGE_RW);
224} 219}
225 220
226static inline pte_t pte_mkexec(pte_t pte) 221static inline pte_t pte_mkexec(pte_t pte)
227{ 222{
228 return __pte(pte_val(pte) & ~(pteval_t)_PAGE_NX); 223 return __pte(pte_val(pte) & ~_PAGE_NX);
229} 224}
230 225
231static inline pte_t pte_mkdirty(pte_t pte) 226static inline pte_t pte_mkdirty(pte_t pte)
@@ -250,7 +245,7 @@ static inline pte_t pte_mkhuge(pte_t pte)
250 245
251static inline pte_t pte_clrhuge(pte_t pte) 246static inline pte_t pte_clrhuge(pte_t pte)
252{ 247{
253 return __pte(pte_val(pte) & ~(pteval_t)_PAGE_PSE); 248 return __pte(pte_val(pte) & ~_PAGE_PSE);
254} 249}
255 250
256static inline pte_t pte_mkglobal(pte_t pte) 251static inline pte_t pte_mkglobal(pte_t pte)
@@ -260,7 +255,7 @@ static inline pte_t pte_mkglobal(pte_t pte)
260 255
261static inline pte_t pte_clrglobal(pte_t pte) 256static inline pte_t pte_clrglobal(pte_t pte)
262{ 257{
263 return __pte(pte_val(pte) & ~(pteval_t)_PAGE_GLOBAL); 258 return __pte(pte_val(pte) & ~_PAGE_GLOBAL);
264} 259}
265 260
266static inline pte_t pte_mkspecial(pte_t pte) 261static inline pte_t pte_mkspecial(pte_t pte)
@@ -305,7 +300,7 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
305 return __pgprot(preservebits | addbits); 300 return __pgprot(preservebits | addbits);
306} 301}
307 302
308#define pte_pgprot(x) __pgprot(pte_val(x) & ~PTE_MASK) 303#define pte_pgprot(x) __pgprot(pte_flags(x) & ~PTE_MASK)
309 304
310#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) 305#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
311 306
@@ -369,8 +364,15 @@ enum {
369 PG_LEVEL_4K, 364 PG_LEVEL_4K,
370 PG_LEVEL_2M, 365 PG_LEVEL_2M,
371 PG_LEVEL_1G, 366 PG_LEVEL_1G,
367 PG_LEVEL_NUM
372}; 368};
373 369
370#ifdef CONFIG_PROC_FS
371extern void update_page_count(int level, unsigned long pages);
372#else
373static inline void update_page_count(int level, unsigned long pages) { }
374#endif
375
374/* 376/*
375 * Helper function that returns the kernel pagetable entry controlling 377 * Helper function that returns the kernel pagetable entry controlling
376 * the virtual address 'address'. NULL means no pagetable entry present. 378 * the virtual address 'address'. NULL means no pagetable entry present.