diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-01-30 07:32:44 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:44 -0500 |
commit | 11b7c7dc945b8802c459baa3304c1b501d2bf872 (patch) | |
tree | e07b1dbc96584362eabcca91f43177e15e0a1ced /include/asm-x86/page.h | |
parent | e62f4473f32a882a537b32cb7202da8d5d7c4f1f (diff) |
x86: page.h: move things back to their own files
# HG changeset patch
# User Jeremy Fitzhardinge <jeremy@xensource.com>
# Date 1199321648 28800
# Node ID 22f6a5902285b58bfc1fbbd9e183498c9017bd78
# Parent bba9287641ff90e836d090d80b5c0a846aab7162
x86: page.h: move things back to their own files
Oops, asm/page.h has turned into an #ifdef hellhole. Move
32/64-specific things back to their own headers to make it somewhat
comprehensible...
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/page.h')
-rw-r--r-- | include/asm-x86/page.h | 212 |
1 files changed, 6 insertions, 206 deletions
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index f65a2ae6e323..3a00d0d9dfd3 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) | 8 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) |
9 | #define PAGE_MASK (~(PAGE_SIZE-1)) | 9 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
10 | 10 | ||
11 | #ifdef __KERNEL__ | ||
12 | |||
11 | #define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK) | 13 | #define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK) |
12 | #define PTE_MASK PHYSICAL_PAGE_MASK | 14 | #define PTE_MASK PHYSICAL_PAGE_MASK |
13 | 15 | ||
@@ -30,208 +32,11 @@ | |||
30 | #endif | 32 | #endif |
31 | 33 | ||
32 | #ifdef CONFIG_X86_64 | 34 | #ifdef CONFIG_X86_64 |
33 | #define PAGETABLE_LEVELS 4 | 35 | #include <asm/page_64.h> |
34 | 36 | #else | |
35 | #define THREAD_ORDER 1 | 37 | #include <asm/page_32.h> |
36 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) | ||
37 | #define CURRENT_MASK (~(THREAD_SIZE-1)) | ||
38 | |||
39 | #define EXCEPTION_STACK_ORDER 0 | ||
40 | #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) | ||
41 | |||
42 | #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1) | ||
43 | #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) | ||
44 | |||
45 | #define IRQSTACK_ORDER 2 | ||
46 | #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) | ||
47 | |||
48 | #define STACKFAULT_STACK 1 | ||
49 | #define DOUBLEFAULT_STACK 2 | ||
50 | #define NMI_STACK 3 | ||
51 | #define DEBUG_STACK 4 | ||
52 | #define MCE_STACK 5 | ||
53 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ | ||
54 | |||
55 | #define __PAGE_OFFSET _AC(0xffff810000000000, UL) | ||
56 | |||
57 | #define __PHYSICAL_START CONFIG_PHYSICAL_START | ||
58 | #define __KERNEL_ALIGN 0x200000 | ||
59 | |||
60 | /* | ||
61 | * Make sure kernel is aligned to 2MB address. Catching it at compile | ||
62 | * time is better. Change your config file and compile the kernel | ||
63 | * for a 2MB aligned address (CONFIG_PHYSICAL_START) | ||
64 | */ | ||
65 | #if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0 | ||
66 | #error "CONFIG_PHYSICAL_START must be a multiple of 2MB" | ||
67 | #endif | ||
68 | |||
69 | #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) | ||
70 | #define __START_KERNEL_map _AC(0xffffffff80000000, UL) | ||
71 | |||
72 | /* See Documentation/x86_64/mm.txt for a description of the memory map. */ | ||
73 | #define __PHYSICAL_MASK_SHIFT 46 | ||
74 | #define __VIRTUAL_MASK_SHIFT 48 | ||
75 | |||
76 | #define KERNEL_TEXT_SIZE (40*1024*1024) | ||
77 | #define KERNEL_TEXT_START _AC(0xffffffff80000000, UL) | ||
78 | |||
79 | #ifndef __ASSEMBLY__ | ||
80 | void clear_page(void *page); | ||
81 | void copy_page(void *to, void *from); | ||
82 | |||
83 | extern unsigned long end_pfn; | ||
84 | extern unsigned long end_pfn_map; | ||
85 | extern unsigned long phys_base; | ||
86 | |||
87 | extern unsigned long __phys_addr(unsigned long); | ||
88 | #define __phys_reloc_hide(x) (x) | ||
89 | |||
90 | /* | ||
91 | * These are used to make use of C type-checking.. | ||
92 | */ | ||
93 | typedef unsigned long pteval_t; | ||
94 | typedef unsigned long pmdval_t; | ||
95 | typedef unsigned long pudval_t; | ||
96 | typedef unsigned long pgdval_t; | ||
97 | typedef unsigned long pgprotval_t; | ||
98 | typedef unsigned long phys_addr_t; | ||
99 | |||
100 | typedef struct { pteval_t pte; } pte_t; | ||
101 | |||
102 | #define native_pte_val(x) ((x).pte) | ||
103 | #define native_make_pte(x) ((pte_t) { (x) } ) | ||
104 | |||
105 | #define vmemmap ((struct page *)VMEMMAP_START) | ||
106 | |||
107 | #endif /* !__ASSEMBLY__ */ | ||
108 | |||
109 | #endif /* CONFIG_X86_64 */ | 38 | #endif /* CONFIG_X86_64 */ |
110 | 39 | ||
111 | #ifdef CONFIG_X86_32 | ||
112 | |||
113 | /* | ||
114 | * This handles the memory map. | ||
115 | * | ||
116 | * A __PAGE_OFFSET of 0xC0000000 means that the kernel has | ||
117 | * a virtual address space of one gigabyte, which limits the | ||
118 | * amount of physical memory you can use to about 950MB. | ||
119 | * | ||
120 | * If you want more physical memory than this then see the CONFIG_HIGHMEM4G | ||
121 | * and CONFIG_HIGHMEM64G options in the kernel configuration. | ||
122 | */ | ||
123 | #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) | ||
124 | |||
125 | #ifdef CONFIG_X86_PAE | ||
126 | #define __PHYSICAL_MASK_SHIFT 36 | ||
127 | #define __VIRTUAL_MASK_SHIFT 32 | ||
128 | #define PAGETABLE_LEVELS 3 | ||
129 | |||
130 | #ifndef __ASSEMBLY__ | ||
131 | typedef u64 pteval_t; | ||
132 | typedef u64 pmdval_t; | ||
133 | typedef u64 pudval_t; | ||
134 | typedef u64 pgdval_t; | ||
135 | typedef u64 pgprotval_t; | ||
136 | typedef u64 phys_addr_t; | ||
137 | |||
138 | typedef struct { unsigned long pte_low, pte_high; } pte_t; | ||
139 | |||
140 | static inline unsigned long long native_pte_val(pte_t pte) | ||
141 | { | ||
142 | return pte.pte_low | ((unsigned long long)pte.pte_high << 32); | ||
143 | } | ||
144 | |||
145 | static inline pte_t native_make_pte(unsigned long long val) | ||
146 | { | ||
147 | return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ; | ||
148 | } | ||
149 | |||
150 | #endif /* __ASSEMBLY__ | ||
151 | */ | ||
152 | #else /* !CONFIG_X86_PAE */ | ||
153 | #define __PHYSICAL_MASK_SHIFT 32 | ||
154 | #define __VIRTUAL_MASK_SHIFT 32 | ||
155 | #define PAGETABLE_LEVELS 2 | ||
156 | |||
157 | #ifndef __ASSEMBLY__ | ||
158 | typedef unsigned long pteval_t; | ||
159 | typedef unsigned long pmdval_t; | ||
160 | typedef unsigned long pudval_t; | ||
161 | typedef unsigned long pgdval_t; | ||
162 | typedef unsigned long pgprotval_t; | ||
163 | typedef unsigned long phys_addr_t; | ||
164 | |||
165 | typedef struct { pteval_t pte_low; } pte_t; | ||
166 | typedef pte_t boot_pte_t; | ||
167 | |||
168 | static inline unsigned long native_pte_val(pte_t pte) | ||
169 | { | ||
170 | return pte.pte_low; | ||
171 | } | ||
172 | |||
173 | static inline pte_t native_make_pte(unsigned long val) | ||
174 | { | ||
175 | return (pte_t) { .pte_low = val }; | ||
176 | } | ||
177 | |||
178 | #endif /* __ASSEMBLY__ */ | ||
179 | #endif /* CONFIG_X86_PAE */ | ||
180 | |||
181 | #ifdef CONFIG_HUGETLB_PAGE | ||
182 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | ||
183 | #endif | ||
184 | |||
185 | #ifndef __ASSEMBLY__ | ||
186 | #define __phys_addr(x) ((x)-PAGE_OFFSET) | ||
187 | #define __phys_reloc_hide(x) RELOC_HIDE((x), 0) | ||
188 | |||
189 | #ifdef CONFIG_FLATMEM | ||
190 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | ||
191 | #endif /* CONFIG_FLATMEM */ | ||
192 | |||
193 | extern int nx_enabled; | ||
194 | |||
195 | /* | ||
196 | * This much address space is reserved for vmalloc() and iomap() | ||
197 | * as well as fixmap mappings. | ||
198 | */ | ||
199 | extern unsigned int __VMALLOC_RESERVE; | ||
200 | extern int sysctl_legacy_va_layout; | ||
201 | extern int page_is_ram(unsigned long pagenr); | ||
202 | |||
203 | #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) | ||
204 | #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) | ||
205 | |||
206 | #ifdef CONFIG_X86_USE_3DNOW | ||
207 | #include <asm/mmx.h> | ||
208 | |||
209 | static inline void clear_page(void *page) | ||
210 | { | ||
211 | mmx_clear_page(page); | ||
212 | } | ||
213 | |||
214 | static inline void copy_page(void *to, void *from) | ||
215 | { | ||
216 | mmx_copy_page(to, from); | ||
217 | } | ||
218 | #else /* !CONFIG_X86_USE_3DNOW */ | ||
219 | #include <linux/string.h> | ||
220 | |||
221 | static inline void clear_page(void *page) | ||
222 | { | ||
223 | memset(page, 0, PAGE_SIZE); | ||
224 | } | ||
225 | |||
226 | static inline void copy_page(void *to, void *from) | ||
227 | { | ||
228 | memcpy(to, from, PAGE_SIZE); | ||
229 | } | ||
230 | #endif /* CONFIG_X86_3DNOW */ | ||
231 | #endif /* !__ASSEMBLY__ */ | ||
232 | |||
233 | #endif /* CONFIG_X86_32 */ | ||
234 | |||
235 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) | 40 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) |
236 | 41 | ||
237 | #define VM_DATA_DEFAULT_FLAGS \ | 42 | #define VM_DATA_DEFAULT_FLAGS \ |
@@ -349,10 +154,5 @@ static inline pmdval_t native_pmd_val(pmd_t pmd) | |||
349 | 154 | ||
350 | #define __HAVE_ARCH_GATE_AREA 1 | 155 | #define __HAVE_ARCH_GATE_AREA 1 |
351 | 156 | ||
352 | #ifdef CONFIG_X86_32 | 157 | #endif /* __KERNEL__ */ |
353 | # include "page_32.h" | ||
354 | #else | ||
355 | # include "page_64.h" | ||
356 | #endif | ||
357 | |||
358 | #endif /* _ASM_X86_PAGE_H */ | 158 | #endif /* _ASM_X86_PAGE_H */ |