aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-x86/Kbuild3
-rw-r--r--include/asm-x86/page.h212
-rw-r--r--include/asm-x86/page_32.h121
-rw-r--r--include/asm-x86/page_64.h74
4 files changed, 187 insertions, 223 deletions
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
index 22e3a284c1ed..e6189b229143 100644
--- a/include/asm-x86/Kbuild
+++ b/include/asm-x86/Kbuild
@@ -15,8 +15,7 @@ unifdef-y += ist.h
15unifdef-y += mce.h 15unifdef-y += mce.h
16unifdef-y += msr.h 16unifdef-y += msr.h
17unifdef-y += mtrr.h 17unifdef-y += mtrr.h
18unifdef-y += page_32.h 18unifdef-y += page.h
19unifdef-y += page_64.h
20unifdef-y += posix_types_32.h 19unifdef-y += posix_types_32.h
21unifdef-y += posix_types_64.h 20unifdef-y += posix_types_64.h
22unifdef-y += ptrace.h 21unifdef-y += ptrace.h
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__
80void clear_page(void *page);
81void copy_page(void *to, void *from);
82
83extern unsigned long end_pfn;
84extern unsigned long end_pfn_map;
85extern unsigned long phys_base;
86
87extern 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 */
93typedef unsigned long pteval_t;
94typedef unsigned long pmdval_t;
95typedef unsigned long pudval_t;
96typedef unsigned long pgdval_t;
97typedef unsigned long pgprotval_t;
98typedef unsigned long phys_addr_t;
99
100typedef 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__
131typedef u64 pteval_t;
132typedef u64 pmdval_t;
133typedef u64 pudval_t;
134typedef u64 pgdval_t;
135typedef u64 pgprotval_t;
136typedef u64 phys_addr_t;
137
138typedef struct { unsigned long pte_low, pte_high; } pte_t;
139
140static 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
145static 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__
158typedef unsigned long pteval_t;
159typedef unsigned long pmdval_t;
160typedef unsigned long pudval_t;
161typedef unsigned long pgdval_t;
162typedef unsigned long pgprotval_t;
163typedef unsigned long phys_addr_t;
164
165typedef struct { pteval_t pte_low; } pte_t;
166typedef pte_t boot_pte_t;
167
168static inline unsigned long native_pte_val(pte_t pte)
169{
170 return pte.pte_low;
171}
172
173static 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
193extern int nx_enabled;
194
195/*
196 * This much address space is reserved for vmalloc() and iomap()
197 * as well as fixmap mappings.
198 */
199extern unsigned int __VMALLOC_RESERVE;
200extern int sysctl_legacy_va_layout;
201extern 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
209static inline void clear_page(void *page)
210{
211 mmx_clear_page(page);
212}
213
214static 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
221static inline void clear_page(void *page)
222{
223 memset(page, 0, PAGE_SIZE);
224}
225
226static 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 */
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h
index c27b41fd0254..e424bef4395a 100644
--- a/include/asm-x86/page_32.h
+++ b/include/asm-x86/page_32.h
@@ -1,23 +1,124 @@
1#ifndef _I386_PAGE_H 1#ifndef _ASM_X86_PAGE_32_H
2#define _I386_PAGE_H 2#define _ASM_X86_PAGE_32_H
3
4/*
5 * This handles the memory map.
6 *
7 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
8 * a virtual address space of one gigabyte, which limits the
9 * amount of physical memory you can use to about 950MB.
10 *
11 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
12 * and CONFIG_HIGHMEM64G options in the kernel configuration.
13 */
14#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
15
16#ifdef CONFIG_X86_PAE
17#define __PHYSICAL_MASK_SHIFT 36
18#define __VIRTUAL_MASK_SHIFT 32
19#define PAGETABLE_LEVELS 3
3 20
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
22typedef u64 pteval_t;
23typedef u64 pmdval_t;
24typedef u64 pudval_t;
25typedef u64 pgdval_t;
26typedef u64 pgprotval_t;
27typedef u64 phys_addr_t;
6 28
7/* 29typedef struct { unsigned long pte_low, pte_high; } pte_t;
8 * These are used to make use of C type-checking.. 30
31static inline unsigned long long native_pte_val(pte_t pte)
32{
33 return pte.pte_low | ((unsigned long long)pte.pte_high << 32);
34}
35
36static inline pte_t native_make_pte(unsigned long long val)
37{
38 return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ;
39}
40
41#endif /* __ASSEMBLY__
9 */ 42 */
43#else /* !CONFIG_X86_PAE */
44#define __PHYSICAL_MASK_SHIFT 32
45#define __VIRTUAL_MASK_SHIFT 32
46#define PAGETABLE_LEVELS 2
47
48#ifndef __ASSEMBLY__
49typedef unsigned long pteval_t;
50typedef unsigned long pmdval_t;
51typedef unsigned long pudval_t;
52typedef unsigned long pgdval_t;
53typedef unsigned long pgprotval_t;
54typedef unsigned long phys_addr_t;
10 55
11#endif /* !__ASSEMBLY__ */ 56typedef struct { pteval_t pte_low; } pte_t;
57typedef pte_t boot_pte_t;
58
59static inline unsigned long native_pte_val(pte_t pte)
60{
61 return pte.pte_low;
62}
63
64static inline pte_t native_make_pte(unsigned long val)
65{
66 return (pte_t) { .pte_low = val };
67}
68
69#endif /* __ASSEMBLY__ */
70#endif /* CONFIG_X86_PAE */
71
72#ifdef CONFIG_HUGETLB_PAGE
73#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
74#endif
12 75
13#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
77#define __phys_addr(x) ((x)-PAGE_OFFSET)
78#define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
79
80#ifdef CONFIG_FLATMEM
81#define pfn_valid(pfn) ((pfn) < max_mapnr)
82#endif /* CONFIG_FLATMEM */
83
84extern int nx_enabled;
85
86/*
87 * This much address space is reserved for vmalloc() and iomap()
88 * as well as fixmap mappings.
89 */
90extern unsigned int __VMALLOC_RESERVE;
91extern int sysctl_legacy_va_layout;
92extern int page_is_ram(unsigned long pagenr);
93
94#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
95#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
14 96
15struct vm_area_struct; 97#ifdef CONFIG_X86_USE_3DNOW
98#include <asm/mmx.h>
16 99
17#endif /* __ASSEMBLY__ */ 100static inline void clear_page(void *page)
101{
102 mmx_clear_page(page);
103}
18 104
105static inline void copy_page(void *to, void *from)
106{
107 mmx_copy_page(to, from);
108}
109#else /* !CONFIG_X86_USE_3DNOW */
110#include <linux/string.h>
19 111
112static inline void clear_page(void *page)
113{
114 memset(page, 0, PAGE_SIZE);
115}
20 116
21#endif /* __KERNEL__ */ 117static inline void copy_page(void *to, void *from)
118{
119 memcpy(to, from, PAGE_SIZE);
120}
121#endif /* CONFIG_X86_3DNOW */
122#endif /* !__ASSEMBLY__ */
22 123
23#endif /* _I386_PAGE_H */ 124#endif /* _ASM_X86_PAGE_32_H */
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h
index 94d4803aab2d..ebf977a809a8 100644
--- a/include/asm-x86/page_64.h
+++ b/include/asm-x86/page_64.h
@@ -1,17 +1,81 @@
1#ifndef _X86_64_PAGE_H 1#ifndef _X86_64_PAGE_H
2#define _X86_64_PAGE_H 2#define _X86_64_PAGE_H
3 3
4#ifdef __KERNEL__ 4#define PAGETABLE_LEVELS 4
5#ifndef __ASSEMBLY__ 5
6#define THREAD_ORDER 1
7#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
8#define CURRENT_MASK (~(THREAD_SIZE-1))
9
10#define EXCEPTION_STACK_ORDER 0
11#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
12
13#define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
14#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
15
16#define IRQSTACK_ORDER 2
17#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
18
19#define STACKFAULT_STACK 1
20#define DOUBLEFAULT_STACK 2
21#define NMI_STACK 3
22#define DEBUG_STACK 4
23#define MCE_STACK 5
24#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
25
26#define __PAGE_OFFSET _AC(0xffff810000000000, UL)
27
28#define __PHYSICAL_START CONFIG_PHYSICAL_START
29#define __KERNEL_ALIGN 0x200000
6 30
7#endif /* !__ASSEMBLY__ */ 31/*
32 * Make sure kernel is aligned to 2MB address. Catching it at compile
33 * time is better. Change your config file and compile the kernel
34 * for a 2MB aligned address (CONFIG_PHYSICAL_START)
35 */
36#if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
37#error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
38#endif
39
40#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
41#define __START_KERNEL_map _AC(0xffffffff80000000, UL)
42
43/* See Documentation/x86_64/mm.txt for a description of the memory map. */
44#define __PHYSICAL_MASK_SHIFT 46
45#define __VIRTUAL_MASK_SHIFT 48
46
47#define KERNEL_TEXT_SIZE (40*1024*1024)
48#define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
8 49
9#ifndef __ASSEMBLY__ 50#ifndef __ASSEMBLY__
51void clear_page(void *page);
52void copy_page(void *to, void *from);
53
54extern unsigned long end_pfn;
55extern unsigned long end_pfn_map;
56extern unsigned long phys_base;
57
58extern unsigned long __phys_addr(unsigned long);
59#define __phys_reloc_hide(x) (x)
60
61/*
62 * These are used to make use of C type-checking..
63 */
64typedef unsigned long pteval_t;
65typedef unsigned long pmdval_t;
66typedef unsigned long pudval_t;
67typedef unsigned long pgdval_t;
68typedef unsigned long pgprotval_t;
69typedef unsigned long phys_addr_t;
70
71typedef struct { pteval_t pte; } pte_t;
10 72
73#define native_pte_val(x) ((x).pte)
74#define native_make_pte(x) ((pte_t) { (x) } )
11 75
12#endif /* __ASSEMBLY__ */ 76#define vmemmap ((struct page *)VMEMMAP_START)
13 77
14#endif /* __KERNEL__ */ 78#endif /* !__ASSEMBLY__ */
15 79
16#ifdef CONFIG_FLATMEM 80#ifdef CONFIG_FLATMEM
17#define pfn_valid(pfn) ((pfn) < end_pfn) 81#define pfn_valid(pfn) ((pfn) < end_pfn)