aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-01-30 07:32:41 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:32:41 -0500
commit83a5101bf2fa7dcf09ffd436078a021d32c97f85 (patch)
tree57a99676a79c33274a4c0db5638fe30f434c4f94
parent9566e91d494ed0668edf88f852de7f251fe8fe9a (diff)
x86: page.h: unify constants
# HG changeset patch # User Jeremy Fitzhardinge <jeremy@xensource.com> # Date 1199317360 28800 # Node ID ba0ec40a50a7aef1a3153cea124c35e261f5a2df # Parent c45c263179cb78284b6b869c574457df088027d1 x86: page.h: unify constants There are many constants which are shared by 32 and 64-bit. 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>
-rw-r--r--include/asm-x86/page.h125
-rw-r--r--include/asm-x86/page_32.h46
-rw-r--r--include/asm-x86/page_64.h74
3 files changed, 119 insertions, 126 deletions
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index a757eb26141d..e0fa4a032ea7 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -1,13 +1,116 @@
1#ifdef __KERNEL__ 1#ifndef _ASM_X86_PAGE_H
2# ifdef CONFIG_X86_32 2#define _ASM_X86_PAGE_H
3# include "page_32.h" 3
4# else 4#include <linux/const.h>
5# include "page_64.h" 5
6# endif 6/* PAGE_SHIFT determines the page size */
7#define PAGE_SHIFT 12
8#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1))
10
11#define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK)
12
13#define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT)
14#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
15
16#define HPAGE_SHIFT PMD_SHIFT
17#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
18#define HPAGE_MASK (~(HPAGE_SIZE - 1))
19#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
20
21/* to align the pointer to the (next) page boundary */
22#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
23
24#define __PHYSICAL_MASK ((_AC(1,UL) << __PHYSICAL_MASK_SHIFT) - 1)
25#define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)
26
27
28#ifdef CONFIG_X86_64
29#define THREAD_ORDER 1
30#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
31#define CURRENT_MASK (~(THREAD_SIZE-1))
32
33#define EXCEPTION_STACK_ORDER 0
34#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
35
36#define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
37#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
38
39#define IRQSTACK_ORDER 2
40#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
41
42#define STACKFAULT_STACK 1
43#define DOUBLEFAULT_STACK 2
44#define NMI_STACK 3
45#define DEBUG_STACK 4
46#define MCE_STACK 5
47#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
48
49#define __PAGE_OFFSET _AC(0xffff810000000000, UL)
50
51#define __PHYSICAL_START CONFIG_PHYSICAL_START
52#define __KERNEL_ALIGN 0x200000
53
54/*
55 * Make sure kernel is aligned to 2MB address. Catching it at compile
56 * time is better. Change your config file and compile the kernel
57 * for a 2MB aligned address (CONFIG_PHYSICAL_START)
58 */
59#if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
60#error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
61#endif
62
63#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
64#define __START_KERNEL_map _AC(0xffffffff80000000, UL)
65
66/* See Documentation/x86_64/mm.txt for a description of the memory map. */
67#define __PHYSICAL_MASK_SHIFT 46
68#define __VIRTUAL_MASK_SHIFT 48
69
70#define KERNEL_TEXT_SIZE (40*1024*1024)
71#define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
72
73#endif /* CONFIG_X86_64 */
74
75#ifdef CONFIG_X86_32
76
77/*
78 * This handles the memory map.
79 *
80 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
81 * a virtual address space of one gigabyte, which limits the
82 * amount of physical memory you can use to about 950MB.
83 *
84 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
85 * and CONFIG_HIGHMEM64G options in the kernel configuration.
86 */
87#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
88
89#ifdef CONFIG_X86_PAE
90#define __PHYSICAL_MASK_SHIFT 36
91#define __VIRTUAL_MASK_SHIFT 32
92#else /* !CONFIG_X86_PAE */
93#define __PHYSICAL_MASK_SHIFT 32
94#define __VIRTUAL_MASK_SHIFT 32
95#endif /* CONFIG_X86_PAE */
96
97#ifdef CONFIG_HUGETLB_PAGE
98#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
99#endif
100
101#endif /* CONFIG_X86_32 */
102
103#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
104
105#define VM_DATA_DEFAULT_FLAGS \
106 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
107 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
108
109
110#ifdef CONFIG_X86_32
111# include "page_32.h"
7#else 112#else
8# ifdef __i386__ 113# include "page_64.h"
9# include "page_32.h"
10# else
11# include "page_64.h"
12# endif
13#endif 114#endif
115
116#endif /* _ASM_X86_PAGE_H */
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h
index c620c934e557..69e520059b26 100644
--- a/include/asm-x86/page_32.h
+++ b/include/asm-x86/page_32.h
@@ -1,14 +1,6 @@
1#ifndef _I386_PAGE_H 1#ifndef _I386_PAGE_H
2#define _I386_PAGE_H 2#define _I386_PAGE_H
3 3
4/* PAGE_SHIFT determines the page size */
5#define PAGE_SHIFT 12
6#define PAGE_SIZE (1UL << PAGE_SHIFT)
7#define PAGE_MASK (~(PAGE_SIZE-1))
8
9#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
10#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
11
12#ifdef __KERNEL__ 4#ifdef __KERNEL__
13#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
14 6
@@ -111,7 +103,6 @@ static inline pte_t native_make_pte(unsigned long long val)
111#define __pmd(x) native_make_pmd(x) 103#define __pmd(x) native_make_pmd(x)
112#endif 104#endif
113 105
114#define HPAGE_SHIFT 21
115#include <asm-generic/pgtable-nopud.h> 106#include <asm-generic/pgtable-nopud.h>
116#else /* !CONFIG_X86_PAE */ 107#else /* !CONFIG_X86_PAE */
117typedef struct { unsigned long pte_low; } pte_t; 108typedef struct { unsigned long pte_low; } pte_t;
@@ -139,19 +130,11 @@ static inline pte_t native_make_pte(unsigned long val)
139 return (pte_t) { .pte_low = val }; 130 return (pte_t) { .pte_low = val };
140} 131}
141 132
142#define HPAGE_SHIFT 22
143#include <asm-generic/pgtable-nopmd.h> 133#include <asm-generic/pgtable-nopmd.h>
144#endif /* CONFIG_X86_PAE */ 134#endif /* CONFIG_X86_PAE */
145 135
146#define PTE_MASK PAGE_MASK 136#define PTE_MASK PAGE_MASK
147 137
148#ifdef CONFIG_HUGETLB_PAGE
149#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
150#define HPAGE_MASK (~(HPAGE_SIZE - 1))
151#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
152#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
153#endif
154
155#define pgprot_val(x) ((x).pgprot) 138#define pgprot_val(x) ((x).pgprot)
156#define __pgprot(x) ((pgprot_t) { (x) } ) 139#define __pgprot(x) ((pgprot_t) { (x) } )
157 140
@@ -164,22 +147,6 @@ static inline pte_t native_make_pte(unsigned long val)
164 147
165#endif /* !__ASSEMBLY__ */ 148#endif /* !__ASSEMBLY__ */
166 149
167/* to align the pointer to the (next) page boundary */
168#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
169
170/*
171 * This handles the memory map.. We could make this a config
172 * option, but too many people screw it up, and too few need
173 * it.
174 *
175 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
176 * a virtual address space of one gigabyte, which limits the
177 * amount of physical memory you can use to about 950MB.
178 *
179 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
180 * and CONFIG_HIGHMEM64G options in the kernel configuration.
181 */
182
183#ifndef __ASSEMBLY__ 150#ifndef __ASSEMBLY__
184 151
185struct vm_area_struct; 152struct vm_area_struct;
@@ -196,14 +163,6 @@ extern int page_is_ram(unsigned long pagenr);
196 163
197#endif /* __ASSEMBLY__ */ 164#endif /* __ASSEMBLY__ */
198 165
199#ifdef __ASSEMBLY__
200#define __PAGE_OFFSET CONFIG_PAGE_OFFSET
201#else
202#define __PAGE_OFFSET ((unsigned long)CONFIG_PAGE_OFFSET)
203#endif
204
205
206#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
207#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) 166#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
208#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) 167#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
209#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 168#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
@@ -219,11 +178,6 @@ extern int page_is_ram(unsigned long pagenr);
219 178
220#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 179#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
221 180
222#define VM_DATA_DEFAULT_FLAGS \
223 (VM_READ | VM_WRITE | \
224 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
225 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
226
227#include <asm-generic/memory_model.h> 181#include <asm-generic/memory_model.h>
228#include <asm-generic/page.h> 182#include <asm-generic/page.h>
229 183
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h
index 068b5e4cea4c..69ef7cf9dadd 100644
--- a/include/asm-x86/page_64.h
+++ b/include/asm-x86/page_64.h
@@ -1,42 +1,6 @@
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#include <linux/const.h>
5
6/* PAGE_SHIFT determines the page size */
7#define PAGE_SHIFT 12
8#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1))
10#define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK)
11
12#define THREAD_ORDER 1
13#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
14#define CURRENT_MASK (~(THREAD_SIZE-1))
15
16#define EXCEPTION_STACK_ORDER 0
17#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
18
19#define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
20#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
21
22#define IRQSTACK_ORDER 2
23#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
24
25#define STACKFAULT_STACK 1
26#define DOUBLEFAULT_STACK 2
27#define NMI_STACK 3
28#define DEBUG_STACK 4
29#define MCE_STACK 5
30#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
31
32#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
33#define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT)
34
35#define HPAGE_SHIFT PMD_SHIFT
36#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
37#define HPAGE_MASK (~(HPAGE_SIZE - 1))
38#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
39
40#ifdef __KERNEL__ 4#ifdef __KERNEL__
41#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
42 6
@@ -90,35 +54,6 @@ extern unsigned long phys_base;
90 54
91#endif /* !__ASSEMBLY__ */ 55#endif /* !__ASSEMBLY__ */
92 56
93#define __PHYSICAL_START CONFIG_PHYSICAL_START
94#define __KERNEL_ALIGN 0x200000
95
96/*
97 * Make sure kernel is aligned to 2MB address. Catching it at compile
98 * time is better. Change your config file and compile the kernel
99 * for a 2MB aligned address (CONFIG_PHYSICAL_START)
100 */
101#if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
102#error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
103#endif
104
105#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
106#define __START_KERNEL_map _AC(0xffffffff80000000, UL)
107#define __PAGE_OFFSET _AC(0xffff810000000000, UL)
108
109/* to align the pointer to the (next) page boundary */
110#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
111
112/* See Documentation/x86_64/mm.txt for a description of the memory map. */
113#define __PHYSICAL_MASK_SHIFT 46
114#define __PHYSICAL_MASK ((_AC(1,UL) << __PHYSICAL_MASK_SHIFT) - 1)
115#define __VIRTUAL_MASK_SHIFT 48
116#define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)
117
118#define KERNEL_TEXT_SIZE (40*1024*1024)
119#define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
120#define PAGE_OFFSET __PAGE_OFFSET
121
122#ifndef __ASSEMBLY__ 57#ifndef __ASSEMBLY__
123 58
124#include <asm/bug.h> 59#include <asm/bug.h>
@@ -138,10 +73,6 @@ extern unsigned long __phys_addr(unsigned long);
138#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 73#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
139#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 74#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
140 75
141#define VM_DATA_DEFAULT_FLAGS \
142 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
143 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
144
145#define __HAVE_ARCH_GATE_AREA 1 76#define __HAVE_ARCH_GATE_AREA 1
146#define vmemmap ((struct page *)VMEMMAP_START) 77#define vmemmap ((struct page *)VMEMMAP_START)
147 78
@@ -150,4 +81,9 @@ extern unsigned long __phys_addr(unsigned long);
150 81
151#endif /* __KERNEL__ */ 82#endif /* __KERNEL__ */
152 83
84#ifdef CONFIG_FLATMEM
85#define pfn_valid(pfn) ((pfn) < end_pfn)
86#endif
87
88
153#endif /* _X86_64_PAGE_H */ 89#endif /* _X86_64_PAGE_H */