diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-02-11 13:20:05 -0500 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-02-11 17:54:10 -0500 |
commit | 54321d947ae9d6a051b81e3eccaf2d8658aeecc6 (patch) | |
tree | 2843c22a872d39cf815ca0d6b250bb8684dadb2b | |
parent | e2f5bda94152fa567f6b48126741014123f982b8 (diff) |
x86: move pte types into pgtable*.h
pgtable*.h is intended for definitions relating to actual pagetables
and their entries, so move all the definitions for
(pte|pmd|pud|pgd)(val)?_t to the appropriate pgtable*.h headers.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
-rw-r--r-- | arch/x86/include/asm/page.h | 22 | ||||
-rw-r--r-- | arch/x86/include/asm/page_32_types.h | 30 | ||||
-rw-r--r-- | arch/x86/include/asm/page_64_types.h | 11 | ||||
-rw-r--r-- | arch/x86/include/asm/page_types.h | 97 | ||||
-rw-r--r-- | arch/x86/include/asm/paravirt.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable-2level_types.h | 15 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable-3level_types.h | 18 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 103 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable_64_types.h | 16 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable_types.h | 107 | ||||
-rw-r--r-- | arch/x86/include/asm/processor.h | 1 |
11 files changed, 215 insertions, 207 deletions
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h index 28423609b00e..467ce69306b2 100644 --- a/arch/x86/include/asm/page.h +++ b/arch/x86/include/asm/page.h | |||
@@ -31,28 +31,6 @@ static inline void copy_user_page(void *to, void *from, unsigned long vaddr, | |||
31 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) | 31 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) |
32 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | 32 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
33 | 33 | ||
34 | #ifdef CONFIG_PARAVIRT | ||
35 | #include <asm/paravirt.h> | ||
36 | #else /* !CONFIG_PARAVIRT */ | ||
37 | |||
38 | #define pgd_val(x) native_pgd_val(x) | ||
39 | #define __pgd(x) native_make_pgd(x) | ||
40 | |||
41 | #ifndef __PAGETABLE_PUD_FOLDED | ||
42 | #define pud_val(x) native_pud_val(x) | ||
43 | #define __pud(x) native_make_pud(x) | ||
44 | #endif | ||
45 | |||
46 | #ifndef __PAGETABLE_PMD_FOLDED | ||
47 | #define pmd_val(x) native_pmd_val(x) | ||
48 | #define __pmd(x) native_make_pmd(x) | ||
49 | #endif | ||
50 | |||
51 | #define pte_val(x) native_pte_val(x) | ||
52 | #define __pte(x) native_make_pte(x) | ||
53 | |||
54 | #endif /* CONFIG_PARAVIRT */ | ||
55 | |||
56 | #define __pa(x) __phys_addr((unsigned long)(x)) | 34 | #define __pa(x) __phys_addr((unsigned long)(x)) |
57 | #define __pa_nodebug(x) __phys_addr_nodebug((unsigned long)(x)) | 35 | #define __pa_nodebug(x) __phys_addr_nodebug((unsigned long)(x)) |
58 | /* __pa_symbol should be used for C visible symbols. | 36 | /* __pa_symbol should be used for C visible symbols. |
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index 83f820a2b108..b5486aaf36ec 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h | |||
@@ -43,36 +43,6 @@ | |||
43 | 43 | ||
44 | #ifndef __ASSEMBLY__ | 44 | #ifndef __ASSEMBLY__ |
45 | 45 | ||
46 | #include <linux/types.h> | ||
47 | |||
48 | #ifdef CONFIG_X86_PAE | ||
49 | typedef u64 pteval_t; | ||
50 | typedef u64 pmdval_t; | ||
51 | typedef u64 pudval_t; | ||
52 | typedef u64 pgdval_t; | ||
53 | typedef u64 pgprotval_t; | ||
54 | |||
55 | typedef union { | ||
56 | struct { | ||
57 | unsigned long pte_low, pte_high; | ||
58 | }; | ||
59 | pteval_t pte; | ||
60 | } pte_t; | ||
61 | #else /* !CONFIG_X86_PAE */ | ||
62 | typedef unsigned long pteval_t; | ||
63 | typedef unsigned long pmdval_t; | ||
64 | typedef unsigned long pudval_t; | ||
65 | typedef unsigned long pgdval_t; | ||
66 | typedef unsigned long pgprotval_t; | ||
67 | |||
68 | typedef union { | ||
69 | pteval_t pte; | ||
70 | pteval_t pte_low; | ||
71 | } pte_t; | ||
72 | #endif /* CONFIG_X86_PAE */ | ||
73 | |||
74 | extern int nx_enabled; | ||
75 | |||
76 | /* | 46 | /* |
77 | * This much address space is reserved for vmalloc() and iomap() | 47 | * This much address space is reserved for vmalloc() and iomap() |
78 | * as well as fixmap mappings. | 48 | * as well as fixmap mappings. |
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index d00cd3880822..bc73af3eda9c 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h | |||
@@ -71,17 +71,6 @@ extern unsigned long phys_base; | |||
71 | extern unsigned long __phys_addr(unsigned long); | 71 | extern unsigned long __phys_addr(unsigned long); |
72 | #define __phys_reloc_hide(x) (x) | 72 | #define __phys_reloc_hide(x) (x) |
73 | 73 | ||
74 | /* | ||
75 | * These are used to make use of C type-checking.. | ||
76 | */ | ||
77 | typedef unsigned long pteval_t; | ||
78 | typedef unsigned long pmdval_t; | ||
79 | typedef unsigned long pudval_t; | ||
80 | typedef unsigned long pgdval_t; | ||
81 | typedef unsigned long pgprotval_t; | ||
82 | |||
83 | typedef struct { pteval_t pte; } pte_t; | ||
84 | |||
85 | #define vmemmap ((struct page *)VMEMMAP_START) | 74 | #define vmemmap ((struct page *)VMEMMAP_START) |
86 | 75 | ||
87 | extern unsigned long init_memory_mapping(unsigned long start, | 76 | extern unsigned long init_memory_mapping(unsigned long start, |
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index 0733853e7c87..9f0c95963358 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h | |||
@@ -46,106 +46,15 @@ | |||
46 | 46 | ||
47 | #ifndef __ASSEMBLY__ | 47 | #ifndef __ASSEMBLY__ |
48 | 48 | ||
49 | #include <linux/types.h> | 49 | struct pgprot; |
50 | |||
51 | typedef struct { pgdval_t pgd; } pgd_t; | ||
52 | typedef struct { pgprotval_t pgprot; } pgprot_t; | ||
53 | |||
54 | static inline pgd_t native_make_pgd(pgdval_t val) | ||
55 | { | ||
56 | return (pgd_t) { val }; | ||
57 | } | ||
58 | |||
59 | static inline pgdval_t native_pgd_val(pgd_t pgd) | ||
60 | { | ||
61 | return pgd.pgd; | ||
62 | } | ||
63 | |||
64 | static inline pgdval_t pgd_flags(pgd_t pgd) | ||
65 | { | ||
66 | return native_pgd_val(pgd) & PTE_FLAGS_MASK; | ||
67 | } | ||
68 | |||
69 | #if PAGETABLE_LEVELS > 3 | ||
70 | typedef struct { pudval_t pud; } pud_t; | ||
71 | |||
72 | static inline pud_t native_make_pud(pmdval_t val) | ||
73 | { | ||
74 | return (pud_t) { val }; | ||
75 | } | ||
76 | |||
77 | static inline pudval_t native_pud_val(pud_t pud) | ||
78 | { | ||
79 | return pud.pud; | ||
80 | } | ||
81 | #else | ||
82 | #include <asm-generic/pgtable-nopud.h> | ||
83 | |||
84 | static inline pudval_t native_pud_val(pud_t pud) | ||
85 | { | ||
86 | return native_pgd_val(pud.pgd); | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | #if PAGETABLE_LEVELS > 2 | ||
91 | typedef struct { pmdval_t pmd; } pmd_t; | ||
92 | |||
93 | static inline pmd_t native_make_pmd(pmdval_t val) | ||
94 | { | ||
95 | return (pmd_t) { val }; | ||
96 | } | ||
97 | |||
98 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
99 | { | ||
100 | return pmd.pmd; | ||
101 | } | ||
102 | #else | ||
103 | #include <asm-generic/pgtable-nopmd.h> | ||
104 | |||
105 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
106 | { | ||
107 | return native_pgd_val(pmd.pud.pgd); | ||
108 | } | ||
109 | #endif | ||
110 | |||
111 | static inline pudval_t pud_flags(pud_t pud) | ||
112 | { | ||
113 | return native_pud_val(pud) & PTE_FLAGS_MASK; | ||
114 | } | ||
115 | |||
116 | static inline pmdval_t pmd_flags(pmd_t pmd) | ||
117 | { | ||
118 | return native_pmd_val(pmd) & PTE_FLAGS_MASK; | ||
119 | } | ||
120 | |||
121 | static inline pte_t native_make_pte(pteval_t val) | ||
122 | { | ||
123 | return (pte_t) { .pte = val }; | ||
124 | } | ||
125 | |||
126 | static inline pteval_t native_pte_val(pte_t pte) | ||
127 | { | ||
128 | return pte.pte; | ||
129 | } | ||
130 | |||
131 | static inline pteval_t pte_flags(pte_t pte) | ||
132 | { | ||
133 | return native_pte_val(pte) & PTE_FLAGS_MASK; | ||
134 | } | ||
135 | |||
136 | #define pgprot_val(x) ((x).pgprot) | ||
137 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
138 | |||
139 | |||
140 | typedef struct page *pgtable_t; | ||
141 | 50 | ||
142 | extern int page_is_ram(unsigned long pagenr); | 51 | extern int page_is_ram(unsigned long pagenr); |
143 | extern int pagerange_is_ram(unsigned long start, unsigned long end); | 52 | extern int pagerange_is_ram(unsigned long start, unsigned long end); |
144 | extern int devmem_is_allowed(unsigned long pagenr); | 53 | extern int devmem_is_allowed(unsigned long pagenr); |
145 | extern void map_devmem(unsigned long pfn, unsigned long size, | 54 | extern void map_devmem(unsigned long pfn, unsigned long size, |
146 | pgprot_t vma_prot); | 55 | struct pgprot vma_prot); |
147 | extern void unmap_devmem(unsigned long pfn, unsigned long size, | 56 | extern void unmap_devmem(unsigned long pfn, unsigned long size, |
148 | pgprot_t vma_prot); | 57 | struct pgprot vma_prot); |
149 | 58 | ||
150 | extern unsigned long max_low_pfn_mapped; | 59 | extern unsigned long max_low_pfn_mapped; |
151 | extern unsigned long max_pfn_mapped; | 60 | extern unsigned long max_pfn_mapped; |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index db570f23b228..7ed73ccd74e7 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * para-virtualization: those hooks are defined here. */ | 4 | * para-virtualization: those hooks are defined here. */ |
5 | 5 | ||
6 | #ifdef CONFIG_PARAVIRT | 6 | #ifdef CONFIG_PARAVIRT |
7 | #include <asm/page_types.h> | 7 | #include <asm/pgtable_types.h> |
8 | #include <asm/asm.h> | 8 | #include <asm/asm.h> |
9 | 9 | ||
10 | /* Bitmask of what can be clobbered: usually at least eax. */ | 10 | /* Bitmask of what can be clobbered: usually at least eax. */ |
diff --git a/arch/x86/include/asm/pgtable-2level_types.h b/arch/x86/include/asm/pgtable-2level_types.h index d77db8990eaa..09ae67efcebd 100644 --- a/arch/x86/include/asm/pgtable-2level_types.h +++ b/arch/x86/include/asm/pgtable-2level_types.h | |||
@@ -1,6 +1,21 @@ | |||
1 | #ifndef _ASM_X86_PGTABLE_2LEVEL_DEFS_H | 1 | #ifndef _ASM_X86_PGTABLE_2LEVEL_DEFS_H |
2 | #define _ASM_X86_PGTABLE_2LEVEL_DEFS_H | 2 | #define _ASM_X86_PGTABLE_2LEVEL_DEFS_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | typedef unsigned long pteval_t; | ||
8 | typedef unsigned long pmdval_t; | ||
9 | typedef unsigned long pudval_t; | ||
10 | typedef unsigned long pgdval_t; | ||
11 | typedef unsigned long pgprotval_t; | ||
12 | |||
13 | typedef union { | ||
14 | pteval_t pte; | ||
15 | pteval_t pte_low; | ||
16 | } pte_t; | ||
17 | #endif /* !__ASSEMBLY__ */ | ||
18 | |||
4 | #define SHARED_KERNEL_PMD 0 | 19 | #define SHARED_KERNEL_PMD 0 |
5 | 20 | ||
6 | /* | 21 | /* |
diff --git a/arch/x86/include/asm/pgtable-3level_types.h b/arch/x86/include/asm/pgtable-3level_types.h index 62561367653c..bcc89625ebe5 100644 --- a/arch/x86/include/asm/pgtable-3level_types.h +++ b/arch/x86/include/asm/pgtable-3level_types.h | |||
@@ -1,6 +1,23 @@ | |||
1 | #ifndef _ASM_X86_PGTABLE_3LEVEL_DEFS_H | 1 | #ifndef _ASM_X86_PGTABLE_3LEVEL_DEFS_H |
2 | #define _ASM_X86_PGTABLE_3LEVEL_DEFS_H | 2 | #define _ASM_X86_PGTABLE_3LEVEL_DEFS_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | typedef u64 pteval_t; | ||
8 | typedef u64 pmdval_t; | ||
9 | typedef u64 pudval_t; | ||
10 | typedef u64 pgdval_t; | ||
11 | typedef u64 pgprotval_t; | ||
12 | |||
13 | typedef union { | ||
14 | struct { | ||
15 | unsigned long pte_low, pte_high; | ||
16 | }; | ||
17 | pteval_t pte; | ||
18 | } pte_t; | ||
19 | #endif /* !__ASSEMBLY__ */ | ||
20 | |||
4 | #ifdef CONFIG_PARAVIRT | 21 | #ifdef CONFIG_PARAVIRT |
5 | #define SHARED_KERNEL_PMD (pv_info.shared_kernel_pmd) | 22 | #define SHARED_KERNEL_PMD (pv_info.shared_kernel_pmd) |
6 | #else | 23 | #else |
@@ -25,4 +42,5 @@ | |||
25 | */ | 42 | */ |
26 | #define PTRS_PER_PTE 512 | 43 | #define PTRS_PER_PTE 512 |
27 | 44 | ||
45 | |||
28 | #endif /* _ASM_X86_PGTABLE_3LEVEL_DEFS_H */ | 46 | #endif /* _ASM_X86_PGTABLE_3LEVEL_DEFS_H */ |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 9f5085097977..b0d1066ab6a5 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -25,6 +25,66 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | |||
25 | extern spinlock_t pgd_lock; | 25 | extern spinlock_t pgd_lock; |
26 | extern struct list_head pgd_list; | 26 | extern struct list_head pgd_list; |
27 | 27 | ||
28 | #ifdef CONFIG_PARAVIRT | ||
29 | #include <asm/paravirt.h> | ||
30 | #else /* !CONFIG_PARAVIRT */ | ||
31 | #define set_pte(ptep, pte) native_set_pte(ptep, pte) | ||
32 | #define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte) | ||
33 | |||
34 | #define set_pte_present(mm, addr, ptep, pte) \ | ||
35 | native_set_pte_present(mm, addr, ptep, pte) | ||
36 | #define set_pte_atomic(ptep, pte) \ | ||
37 | native_set_pte_atomic(ptep, pte) | ||
38 | |||
39 | #define set_pmd(pmdp, pmd) native_set_pmd(pmdp, pmd) | ||
40 | |||
41 | #ifndef __PAGETABLE_PUD_FOLDED | ||
42 | #define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd) | ||
43 | #define pgd_clear(pgd) native_pgd_clear(pgd) | ||
44 | #endif | ||
45 | |||
46 | #ifndef set_pud | ||
47 | # define set_pud(pudp, pud) native_set_pud(pudp, pud) | ||
48 | #endif | ||
49 | |||
50 | #ifndef __PAGETABLE_PMD_FOLDED | ||
51 | #define pud_clear(pud) native_pud_clear(pud) | ||
52 | #endif | ||
53 | |||
54 | #define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep) | ||
55 | #define pmd_clear(pmd) native_pmd_clear(pmd) | ||
56 | |||
57 | #define pte_update(mm, addr, ptep) do { } while (0) | ||
58 | #define pte_update_defer(mm, addr, ptep) do { } while (0) | ||
59 | |||
60 | static inline void __init paravirt_pagetable_setup_start(pgd_t *base) | ||
61 | { | ||
62 | native_pagetable_setup_start(base); | ||
63 | } | ||
64 | |||
65 | static inline void __init paravirt_pagetable_setup_done(pgd_t *base) | ||
66 | { | ||
67 | native_pagetable_setup_done(base); | ||
68 | } | ||
69 | |||
70 | #define pgd_val(x) native_pgd_val(x) | ||
71 | #define __pgd(x) native_make_pgd(x) | ||
72 | |||
73 | #ifndef __PAGETABLE_PUD_FOLDED | ||
74 | #define pud_val(x) native_pud_val(x) | ||
75 | #define __pud(x) native_make_pud(x) | ||
76 | #endif | ||
77 | |||
78 | #ifndef __PAGETABLE_PMD_FOLDED | ||
79 | #define pmd_val(x) native_pmd_val(x) | ||
80 | #define __pmd(x) native_make_pmd(x) | ||
81 | #endif | ||
82 | |||
83 | #define pte_val(x) native_pte_val(x) | ||
84 | #define __pte(x) native_make_pte(x) | ||
85 | |||
86 | #endif /* CONFIG_PARAVIRT */ | ||
87 | |||
28 | /* | 88 | /* |
29 | * The following only work if pte_present() is true. | 89 | * The following only work if pte_present() is true. |
30 | * Undefined behaviour if not.. | 90 | * Undefined behaviour if not.. |
@@ -214,49 +274,6 @@ static inline int is_new_memtype_allowed(unsigned long flags, | |||
214 | return 1; | 274 | return 1; |
215 | } | 275 | } |
216 | 276 | ||
217 | #ifdef CONFIG_PARAVIRT | ||
218 | #include <asm/paravirt.h> | ||
219 | #else /* !CONFIG_PARAVIRT */ | ||
220 | #define set_pte(ptep, pte) native_set_pte(ptep, pte) | ||
221 | #define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte) | ||
222 | |||
223 | #define set_pte_present(mm, addr, ptep, pte) \ | ||
224 | native_set_pte_present(mm, addr, ptep, pte) | ||
225 | #define set_pte_atomic(ptep, pte) \ | ||
226 | native_set_pte_atomic(ptep, pte) | ||
227 | |||
228 | #define set_pmd(pmdp, pmd) native_set_pmd(pmdp, pmd) | ||
229 | |||
230 | #ifndef __PAGETABLE_PUD_FOLDED | ||
231 | #define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd) | ||
232 | #define pgd_clear(pgd) native_pgd_clear(pgd) | ||
233 | #endif | ||
234 | |||
235 | #ifndef set_pud | ||
236 | # define set_pud(pudp, pud) native_set_pud(pudp, pud) | ||
237 | #endif | ||
238 | |||
239 | #ifndef __PAGETABLE_PMD_FOLDED | ||
240 | #define pud_clear(pud) native_pud_clear(pud) | ||
241 | #endif | ||
242 | |||
243 | #define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep) | ||
244 | #define pmd_clear(pmd) native_pmd_clear(pmd) | ||
245 | |||
246 | #define pte_update(mm, addr, ptep) do { } while (0) | ||
247 | #define pte_update_defer(mm, addr, ptep) do { } while (0) | ||
248 | |||
249 | static inline void __init paravirt_pagetable_setup_start(pgd_t *base) | ||
250 | { | ||
251 | native_pagetable_setup_start(base); | ||
252 | } | ||
253 | |||
254 | static inline void __init paravirt_pagetable_setup_done(pgd_t *base) | ||
255 | { | ||
256 | native_pagetable_setup_done(base); | ||
257 | } | ||
258 | #endif /* CONFIG_PARAVIRT */ | ||
259 | |||
260 | #endif /* __ASSEMBLY__ */ | 277 | #endif /* __ASSEMBLY__ */ |
261 | 278 | ||
262 | #ifdef CONFIG_X86_32 | 279 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index ffaf19340686..2f59135c6f2a 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h | |||
@@ -1,6 +1,22 @@ | |||
1 | #ifndef _ASM_X86_PGTABLE_64_DEFS_H | 1 | #ifndef _ASM_X86_PGTABLE_64_DEFS_H |
2 | #define _ASM_X86_PGTABLE_64_DEFS_H | 2 | #define _ASM_X86_PGTABLE_64_DEFS_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | /* | ||
8 | * These are used to make use of C type-checking.. | ||
9 | */ | ||
10 | typedef unsigned long pteval_t; | ||
11 | typedef unsigned long pmdval_t; | ||
12 | typedef unsigned long pudval_t; | ||
13 | typedef unsigned long pgdval_t; | ||
14 | typedef unsigned long pgprotval_t; | ||
15 | |||
16 | typedef struct { pteval_t pte; } pte_t; | ||
17 | |||
18 | #endif /* !__ASSEMBLY__ */ | ||
19 | |||
4 | #define SHARED_KERNEL_PMD 0 | 20 | #define SHARED_KERNEL_PMD 0 |
5 | 21 | ||
6 | /* | 22 | /* |
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index e5d5a8d3577c..a7452f10930e 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h | |||
@@ -162,9 +162,110 @@ | |||
162 | #define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */ | 162 | #define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */ |
163 | #endif | 163 | #endif |
164 | 164 | ||
165 | #ifdef CONFIG_X86_32 | ||
166 | # include "pgtable_32_types.h" | ||
167 | #else | ||
168 | # include "pgtable_64_types.h" | ||
169 | #endif | ||
170 | |||
165 | #ifndef __ASSEMBLY__ | 171 | #ifndef __ASSEMBLY__ |
166 | 172 | ||
173 | #include <linux/types.h> | ||
174 | |||
175 | typedef struct pgprot { pgprotval_t pgprot; } pgprot_t; | ||
176 | |||
177 | typedef struct { pgdval_t pgd; } pgd_t; | ||
178 | |||
179 | static inline pgd_t native_make_pgd(pgdval_t val) | ||
180 | { | ||
181 | return (pgd_t) { val }; | ||
182 | } | ||
183 | |||
184 | static inline pgdval_t native_pgd_val(pgd_t pgd) | ||
185 | { | ||
186 | return pgd.pgd; | ||
187 | } | ||
188 | |||
189 | static inline pgdval_t pgd_flags(pgd_t pgd) | ||
190 | { | ||
191 | return native_pgd_val(pgd) & PTE_FLAGS_MASK; | ||
192 | } | ||
193 | |||
194 | #if PAGETABLE_LEVELS > 3 | ||
195 | typedef struct { pudval_t pud; } pud_t; | ||
196 | |||
197 | static inline pud_t native_make_pud(pmdval_t val) | ||
198 | { | ||
199 | return (pud_t) { val }; | ||
200 | } | ||
201 | |||
202 | static inline pudval_t native_pud_val(pud_t pud) | ||
203 | { | ||
204 | return pud.pud; | ||
205 | } | ||
206 | #else | ||
207 | #include <asm-generic/pgtable-nopud.h> | ||
208 | |||
209 | static inline pudval_t native_pud_val(pud_t pud) | ||
210 | { | ||
211 | return native_pgd_val(pud.pgd); | ||
212 | } | ||
213 | #endif | ||
214 | |||
215 | #if PAGETABLE_LEVELS > 2 | ||
216 | typedef struct { pmdval_t pmd; } pmd_t; | ||
217 | |||
218 | static inline pmd_t native_make_pmd(pmdval_t val) | ||
219 | { | ||
220 | return (pmd_t) { val }; | ||
221 | } | ||
222 | |||
223 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
224 | { | ||
225 | return pmd.pmd; | ||
226 | } | ||
227 | #else | ||
228 | #include <asm-generic/pgtable-nopmd.h> | ||
229 | |||
230 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
231 | { | ||
232 | return native_pgd_val(pmd.pud.pgd); | ||
233 | } | ||
234 | #endif | ||
235 | |||
236 | static inline pudval_t pud_flags(pud_t pud) | ||
237 | { | ||
238 | return native_pud_val(pud) & PTE_FLAGS_MASK; | ||
239 | } | ||
240 | |||
241 | static inline pmdval_t pmd_flags(pmd_t pmd) | ||
242 | { | ||
243 | return native_pmd_val(pmd) & PTE_FLAGS_MASK; | ||
244 | } | ||
245 | |||
246 | static inline pte_t native_make_pte(pteval_t val) | ||
247 | { | ||
248 | return (pte_t) { .pte = val }; | ||
249 | } | ||
250 | |||
251 | static inline pteval_t native_pte_val(pte_t pte) | ||
252 | { | ||
253 | return pte.pte; | ||
254 | } | ||
255 | |||
256 | static inline pteval_t pte_flags(pte_t pte) | ||
257 | { | ||
258 | return native_pte_val(pte) & PTE_FLAGS_MASK; | ||
259 | } | ||
260 | |||
261 | #define pgprot_val(x) ((x).pgprot) | ||
262 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
263 | |||
264 | |||
265 | typedef struct page *pgtable_t; | ||
266 | |||
167 | extern pteval_t __supported_pte_mask; | 267 | extern pteval_t __supported_pte_mask; |
268 | extern int nx_enabled; | ||
168 | 269 | ||
169 | #define pgprot_writecombine pgprot_writecombine | 270 | #define pgprot_writecombine pgprot_writecombine |
170 | extern pgprot_t pgprot_writecombine(pgprot_t prot); | 271 | extern pgprot_t pgprot_writecombine(pgprot_t prot); |
@@ -217,10 +318,4 @@ extern pte_t *lookup_address(unsigned long address, unsigned int *level); | |||
217 | 318 | ||
218 | #endif /* !__ASSEMBLY__ */ | 319 | #endif /* !__ASSEMBLY__ */ |
219 | 320 | ||
220 | #ifdef CONFIG_X86_32 | ||
221 | # include "pgtable_32_types.h" | ||
222 | #else | ||
223 | # include "pgtable_64_types.h" | ||
224 | #endif | ||
225 | |||
226 | #endif /* _ASM_X86_PGTABLE_DEFS_H */ | 321 | #endif /* _ASM_X86_PGTABLE_DEFS_H */ |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 656d02ea509b..963028807744 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -16,6 +16,7 @@ struct mm_struct; | |||
16 | #include <asm/cpufeature.h> | 16 | #include <asm/cpufeature.h> |
17 | #include <asm/system.h> | 17 | #include <asm/system.h> |
18 | #include <asm/page.h> | 18 | #include <asm/page.h> |
19 | #include <asm/pgtable_types.h> | ||
19 | #include <asm/percpu.h> | 20 | #include <asm/percpu.h> |
20 | #include <asm/msr.h> | 21 | #include <asm/msr.h> |
21 | #include <asm/desc_defs.h> | 22 | #include <asm/desc_defs.h> |