diff options
Diffstat (limited to 'include/asm-x86/pgtable.h')
-rw-r--r-- | include/asm-x86/pgtable.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index 04caa2f544df..88a53b1a17f0 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _ASM_X86_PGTABLE_H | 1 | #ifndef ASM_X86__PGTABLE_H |
2 | #define _ASM_X86_PGTABLE_H | 2 | #define ASM_X86__PGTABLE_H |
3 | 3 | ||
4 | #define FIRST_USER_ADDRESS 0 | 4 | #define FIRST_USER_ADDRESS 0 |
5 | 5 | ||
@@ -15,10 +15,11 @@ | |||
15 | #define _PAGE_BIT_PAT 7 /* on 4KB pages */ | 15 | #define _PAGE_BIT_PAT 7 /* on 4KB pages */ |
16 | #define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ | 16 | #define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ |
17 | #define _PAGE_BIT_UNUSED1 9 /* available for programmer */ | 17 | #define _PAGE_BIT_UNUSED1 9 /* available for programmer */ |
18 | #define _PAGE_BIT_UNUSED2 10 | 18 | #define _PAGE_BIT_IOMAP 10 /* flag used to indicate IO mapping */ |
19 | #define _PAGE_BIT_UNUSED3 11 | 19 | #define _PAGE_BIT_UNUSED3 11 |
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_SPECIAL _PAGE_BIT_UNUSED1 | 21 | #define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1 |
22 | #define _PAGE_BIT_CPA_TEST _PAGE_BIT_UNUSED1 | ||
22 | #define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ | 23 | #define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ |
23 | 24 | ||
24 | #define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) | 25 | #define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) |
@@ -31,11 +32,12 @@ | |||
31 | #define _PAGE_PSE (_AT(pteval_t, 1) << _PAGE_BIT_PSE) | 32 | #define _PAGE_PSE (_AT(pteval_t, 1) << _PAGE_BIT_PSE) |
32 | #define _PAGE_GLOBAL (_AT(pteval_t, 1) << _PAGE_BIT_GLOBAL) | 33 | #define _PAGE_GLOBAL (_AT(pteval_t, 1) << _PAGE_BIT_GLOBAL) |
33 | #define _PAGE_UNUSED1 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED1) | 34 | #define _PAGE_UNUSED1 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED1) |
34 | #define _PAGE_UNUSED2 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED2) | 35 | #define _PAGE_IOMAP (_AT(pteval_t, 1) << _PAGE_BIT_IOMAP) |
35 | #define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3) | 36 | #define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3) |
36 | #define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT) | 37 | #define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT) |
37 | #define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE) | 38 | #define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE) |
38 | #define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL) | 39 | #define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL) |
40 | #define _PAGE_CPA_TEST (_AT(pteval_t, 1) << _PAGE_BIT_CPA_TEST) | ||
39 | #define __HAVE_ARCH_PTE_SPECIAL | 41 | #define __HAVE_ARCH_PTE_SPECIAL |
40 | 42 | ||
41 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) | 43 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) |
@@ -97,6 +99,11 @@ | |||
97 | #define __PAGE_KERNEL_LARGE_NOCACHE (__PAGE_KERNEL | _PAGE_CACHE_UC | _PAGE_PSE) | 99 | #define __PAGE_KERNEL_LARGE_NOCACHE (__PAGE_KERNEL | _PAGE_CACHE_UC | _PAGE_PSE) |
98 | #define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE) | 100 | #define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE) |
99 | 101 | ||
102 | #define __PAGE_KERNEL_IO (__PAGE_KERNEL | _PAGE_IOMAP) | ||
103 | #define __PAGE_KERNEL_IO_NOCACHE (__PAGE_KERNEL_NOCACHE | _PAGE_IOMAP) | ||
104 | #define __PAGE_KERNEL_IO_UC_MINUS (__PAGE_KERNEL_UC_MINUS | _PAGE_IOMAP) | ||
105 | #define __PAGE_KERNEL_IO_WC (__PAGE_KERNEL_WC | _PAGE_IOMAP) | ||
106 | |||
100 | #define PAGE_KERNEL __pgprot(__PAGE_KERNEL) | 107 | #define PAGE_KERNEL __pgprot(__PAGE_KERNEL) |
101 | #define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO) | 108 | #define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO) |
102 | #define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) | 109 | #define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) |
@@ -111,6 +118,11 @@ | |||
111 | #define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL) | 118 | #define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL) |
112 | #define PAGE_KERNEL_VSYSCALL_NOCACHE __pgprot(__PAGE_KERNEL_VSYSCALL_NOCACHE) | 119 | #define PAGE_KERNEL_VSYSCALL_NOCACHE __pgprot(__PAGE_KERNEL_VSYSCALL_NOCACHE) |
113 | 120 | ||
121 | #define PAGE_KERNEL_IO __pgprot(__PAGE_KERNEL_IO) | ||
122 | #define PAGE_KERNEL_IO_NOCACHE __pgprot(__PAGE_KERNEL_IO_NOCACHE) | ||
123 | #define PAGE_KERNEL_IO_UC_MINUS __pgprot(__PAGE_KERNEL_IO_UC_MINUS) | ||
124 | #define PAGE_KERNEL_IO_WC __pgprot(__PAGE_KERNEL_IO_WC) | ||
125 | |||
114 | /* xwr */ | 126 | /* xwr */ |
115 | #define __P000 PAGE_NONE | 127 | #define __P000 PAGE_NONE |
116 | #define __P001 PAGE_READONLY | 128 | #define __P001 PAGE_READONLY |
@@ -130,6 +142,22 @@ | |||
130 | #define __S110 PAGE_SHARED_EXEC | 142 | #define __S110 PAGE_SHARED_EXEC |
131 | #define __S111 PAGE_SHARED_EXEC | 143 | #define __S111 PAGE_SHARED_EXEC |
132 | 144 | ||
145 | /* | ||
146 | * early identity mapping pte attrib macros. | ||
147 | */ | ||
148 | #ifdef CONFIG_X86_64 | ||
149 | #define __PAGE_KERNEL_IDENT_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC | ||
150 | #else | ||
151 | /* | ||
152 | * For PDE_IDENT_ATTR include USER bit. As the PDE and PTE protection | ||
153 | * bits are combined, this will alow user to access the high address mapped | ||
154 | * VDSO in the presence of CONFIG_COMPAT_VDSO | ||
155 | */ | ||
156 | #define PTE_IDENT_ATTR 0x003 /* PRESENT+RW */ | ||
157 | #define PDE_IDENT_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */ | ||
158 | #define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */ | ||
159 | #endif | ||
160 | |||
133 | #ifndef __ASSEMBLY__ | 161 | #ifndef __ASSEMBLY__ |
134 | 162 | ||
135 | /* | 163 | /* |
@@ -183,9 +211,16 @@ static inline int pte_exec(pte_t pte) | |||
183 | 211 | ||
184 | static inline int pte_special(pte_t pte) | 212 | static inline int pte_special(pte_t pte) |
185 | { | 213 | { |
186 | return pte_val(pte) & _PAGE_SPECIAL; | 214 | return pte_flags(pte) & _PAGE_SPECIAL; |
187 | } | 215 | } |
188 | 216 | ||
217 | static inline unsigned long pte_pfn(pte_t pte) | ||
218 | { | ||
219 | return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT; | ||
220 | } | ||
221 | |||
222 | #define pte_page(pte) pfn_to_page(pte_pfn(pte)) | ||
223 | |||
189 | static inline int pmd_large(pmd_t pte) | 224 | static inline int pmd_large(pmd_t pte) |
190 | { | 225 | { |
191 | return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == | 226 | return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == |
@@ -313,6 +348,8 @@ static inline void native_pagetable_setup_start(pgd_t *base) {} | |||
313 | static inline void native_pagetable_setup_done(pgd_t *base) {} | 348 | static inline void native_pagetable_setup_done(pgd_t *base) {} |
314 | #endif | 349 | #endif |
315 | 350 | ||
351 | extern int arch_report_meminfo(char *page); | ||
352 | |||
316 | #ifdef CONFIG_PARAVIRT | 353 | #ifdef CONFIG_PARAVIRT |
317 | #include <asm/paravirt.h> | 354 | #include <asm/paravirt.h> |
318 | #else /* !CONFIG_PARAVIRT */ | 355 | #else /* !CONFIG_PARAVIRT */ |
@@ -521,4 +558,4 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count) | |||
521 | #include <asm-generic/pgtable.h> | 558 | #include <asm-generic/pgtable.h> |
522 | #endif /* __ASSEMBLY__ */ | 559 | #endif /* __ASSEMBLY__ */ |
523 | 560 | ||
524 | #endif /* _ASM_X86_PGTABLE_H */ | 561 | #endif /* ASM_X86__PGTABLE_H */ |