aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-x86/page.h50
-rw-r--r--include/asm-x86/page_32.h83
2 files changed, 48 insertions, 85 deletions
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index 014f087d7c27..00353eb5666d 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -116,9 +116,57 @@ typedef struct { pteval_t pte; } pte_t;
116#ifdef CONFIG_X86_PAE 116#ifdef CONFIG_X86_PAE
117#define __PHYSICAL_MASK_SHIFT 36 117#define __PHYSICAL_MASK_SHIFT 36
118#define __VIRTUAL_MASK_SHIFT 32 118#define __VIRTUAL_MASK_SHIFT 32
119#define PAGETABLE_LEVELS 3
120
121#ifndef __ASSEMBLY__
122typedef u64 pteval_t;
123typedef u64 pmdval_t;
124typedef u64 pudval_t;
125typedef u64 pgdval_t;
126typedef u64 pgprotval_t;
127typedef u64 phys_addr_t;
128
129typedef struct { unsigned long pte_low, pte_high; } pte_t;
130
131static inline unsigned long long native_pte_val(pte_t pte)
132{
133 return pte.pte_low | ((unsigned long long)pte.pte_high << 32);
134}
135
136static inline pte_t native_make_pte(unsigned long long val)
137{
138 return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ;
139}
140
141#endif /* __ASSEMBLY__
142 */
119#else /* !CONFIG_X86_PAE */ 143#else /* !CONFIG_X86_PAE */
120#define __PHYSICAL_MASK_SHIFT 32 144#define __PHYSICAL_MASK_SHIFT 32
121#define __VIRTUAL_MASK_SHIFT 32 145#define __VIRTUAL_MASK_SHIFT 32
146#define PAGETABLE_LEVELS 2
147
148#ifndef __ASSEMBLY__
149typedef unsigned long pteval_t;
150typedef unsigned long pmdval_t;
151typedef unsigned long pudval_t;
152typedef unsigned long pgdval_t;
153typedef unsigned long pgprotval_t;
154typedef unsigned long phys_addr_t;
155
156typedef struct { pteval_t pte_low; } pte_t;
157typedef pte_t boot_pte_t;
158
159static inline unsigned long native_pte_val(pte_t pte)
160{
161 return pte.pte_low;
162}
163
164static inline pte_t native_make_pte(unsigned long val)
165{
166 return (pte_t) { .pte_low = val };
167}
168
169#endif /* __ASSEMBLY__ */
122#endif /* CONFIG_X86_PAE */ 170#endif /* CONFIG_X86_PAE */
123 171
124#ifdef CONFIG_HUGETLB_PAGE 172#ifdef CONFIG_HUGETLB_PAGE
@@ -181,7 +229,6 @@ static void inline copy_user_page(void *to, void *from, unsigned long vaddr,
181 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) 229 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
182#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 230#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
183 231
184#ifdef CONFIG_X86_64
185typedef struct { pgdval_t pgd; } pgd_t; 232typedef struct { pgdval_t pgd; } pgd_t;
186typedef struct { pgprotval_t pgprot; } pgprot_t; 233typedef struct { pgprotval_t pgprot; } pgprot_t;
187 234
@@ -252,7 +299,6 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
252 299
253#endif /* CONFIG_PARAVIRT */ 300#endif /* CONFIG_PARAVIRT */
254 301
255#endif /* CONFIG_X86_64 */
256#endif /* __ASSEMBLY__ */ 302#endif /* __ASSEMBLY__ */
257 303
258 304
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h
index b4750ef44920..2d60661ab340 100644
--- a/include/asm-x86/page_32.h
+++ b/include/asm-x86/page_32.h
@@ -9,89 +9,6 @@
9 */ 9 */
10extern int nx_enabled; 10extern int nx_enabled;
11 11
12#ifdef CONFIG_X86_PAE
13typedef struct { unsigned long pte_low, pte_high; } pte_t;
14typedef struct { unsigned long long pmd; } pmd_t;
15typedef struct { unsigned long long pgd; } pgd_t;
16typedef struct { unsigned long long pgprot; } pgprot_t;
17
18static inline unsigned long long native_pgd_val(pgd_t pgd)
19{
20 return pgd.pgd;
21}
22
23static inline unsigned long long native_pmd_val(pmd_t pmd)
24{
25 return pmd.pmd;
26}
27
28static inline unsigned long long native_pte_val(pte_t pte)
29{
30 return pte.pte_low | ((unsigned long long)pte.pte_high << 32);
31}
32
33static inline pgd_t native_make_pgd(unsigned long long val)
34{
35 return (pgd_t) { val };
36}
37
38static inline pmd_t native_make_pmd(unsigned long long val)
39{
40 return (pmd_t) { val };
41}
42
43static inline pte_t native_make_pte(unsigned long long val)
44{
45 return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ;
46}
47
48#ifndef CONFIG_PARAVIRT
49#define pmd_val(x) native_pmd_val(x)
50#define __pmd(x) native_make_pmd(x)
51#endif
52
53#include <asm-generic/pgtable-nopud.h>
54#else /* !CONFIG_X86_PAE */
55typedef struct { unsigned long pte_low; } pte_t;
56typedef struct { unsigned long pgd; } pgd_t;
57typedef struct { unsigned long pgprot; } pgprot_t;
58#define boot_pte_t pte_t /* or would you rather have a typedef */
59
60static inline unsigned long native_pgd_val(pgd_t pgd)
61{
62 return pgd.pgd;
63}
64
65static inline unsigned long native_pte_val(pte_t pte)
66{
67 return pte.pte_low;
68}
69
70static inline pgd_t native_make_pgd(unsigned long val)
71{
72 return (pgd_t) { val };
73}
74
75static inline pte_t native_make_pte(unsigned long val)
76{
77 return (pte_t) { .pte_low = val };
78}
79
80#include <asm-generic/pgtable-nopmd.h>
81#endif /* CONFIG_X86_PAE */
82
83#define PTE_MASK PAGE_MASK
84
85#define pgprot_val(x) ((x).pgprot)
86#define __pgprot(x) ((pgprot_t) { (x) } )
87
88#ifndef CONFIG_PARAVIRT
89#define pgd_val(x) native_pgd_val(x)
90#define __pgd(x) native_make_pgd(x)
91#define pte_val(x) native_pte_val(x)
92#define __pte(x) native_make_pte(x)
93#endif
94
95#endif /* !__ASSEMBLY__ */ 12#endif /* !__ASSEMBLY__ */
96 13
97#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__