aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/page_32.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/page_32.h')
-rw-r--r--include/asm-x86/page_32.h206
1 files changed, 206 insertions, 0 deletions
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h
new file mode 100644
index 000000000000..80ecc66b6d86
--- /dev/null
+++ b/include/asm-x86/page_32.h
@@ -0,0 +1,206 @@
1#ifndef _I386_PAGE_H
2#define _I386_PAGE_H
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__
13#ifndef __ASSEMBLY__
14
15#ifdef CONFIG_X86_USE_3DNOW
16
17#include <asm/mmx.h>
18
19#define clear_page(page) mmx_clear_page((void *)(page))
20#define copy_page(to,from) mmx_copy_page(to,from)
21
22#else
23
24/*
25 * On older X86 processors it's not a win to use MMX here it seems.
26 * Maybe the K6-III ?
27 */
28
29#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
30#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
31
32#endif
33
34#define clear_user_page(page, vaddr, pg) clear_page(page)
35#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
36
37#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
38 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
39#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
40
41/*
42 * These are used to make use of C type-checking..
43 */
44extern int nx_enabled;
45
46#ifdef CONFIG_X86_PAE
47typedef struct { unsigned long pte_low, pte_high; } pte_t;
48typedef struct { unsigned long long pmd; } pmd_t;
49typedef struct { unsigned long long pgd; } pgd_t;
50typedef struct { unsigned long long pgprot; } pgprot_t;
51
52static inline unsigned long long native_pgd_val(pgd_t pgd)
53{
54 return pgd.pgd;
55}
56
57static inline unsigned long long native_pmd_val(pmd_t pmd)
58{
59 return pmd.pmd;
60}
61
62static inline unsigned long long native_pte_val(pte_t pte)
63{
64 return pte.pte_low | ((unsigned long long)pte.pte_high << 32);
65}
66
67static inline pgd_t native_make_pgd(unsigned long long val)
68{
69 return (pgd_t) { val };
70}
71
72static inline pmd_t native_make_pmd(unsigned long long val)
73{
74 return (pmd_t) { val };
75}
76
77static inline pte_t native_make_pte(unsigned long long val)
78{
79 return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ;
80}
81
82#ifndef CONFIG_PARAVIRT
83#define pmd_val(x) native_pmd_val(x)
84#define __pmd(x) native_make_pmd(x)
85#endif
86
87#define HPAGE_SHIFT 21
88#include <asm-generic/pgtable-nopud.h>
89#else /* !CONFIG_X86_PAE */
90typedef struct { unsigned long pte_low; } pte_t;
91typedef struct { unsigned long pgd; } pgd_t;
92typedef struct { unsigned long pgprot; } pgprot_t;
93#define boot_pte_t pte_t /* or would you rather have a typedef */
94
95static inline unsigned long native_pgd_val(pgd_t pgd)
96{
97 return pgd.pgd;
98}
99
100static inline unsigned long native_pte_val(pte_t pte)
101{
102 return pte.pte_low;
103}
104
105static inline pgd_t native_make_pgd(unsigned long val)
106{
107 return (pgd_t) { val };
108}
109
110static inline pte_t native_make_pte(unsigned long val)
111{
112 return (pte_t) { .pte_low = val };
113}
114
115#define HPAGE_SHIFT 22
116#include <asm-generic/pgtable-nopmd.h>
117#endif /* CONFIG_X86_PAE */
118
119#define PTE_MASK PAGE_MASK
120
121#ifdef CONFIG_HUGETLB_PAGE
122#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
123#define HPAGE_MASK (~(HPAGE_SIZE - 1))
124#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
125#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
126#endif
127
128#define pgprot_val(x) ((x).pgprot)
129#define __pgprot(x) ((pgprot_t) { (x) } )
130
131#ifndef CONFIG_PARAVIRT
132#define pgd_val(x) native_pgd_val(x)
133#define __pgd(x) native_make_pgd(x)
134#define pte_val(x) native_pte_val(x)
135#define __pte(x) native_make_pte(x)
136#endif
137
138#endif /* !__ASSEMBLY__ */
139
140/* to align the pointer to the (next) page boundary */
141#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
142
143/*
144 * This handles the memory map.. We could make this a config
145 * option, but too many people screw it up, and too few need
146 * it.
147 *
148 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
149 * a virtual address space of one gigabyte, which limits the
150 * amount of physical memory you can use to about 950MB.
151 *
152 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
153 * and CONFIG_HIGHMEM64G options in the kernel configuration.
154 */
155
156#ifndef __ASSEMBLY__
157
158struct vm_area_struct;
159
160/*
161 * This much address space is reserved for vmalloc() and iomap()
162 * as well as fixmap mappings.
163 */
164extern unsigned int __VMALLOC_RESERVE;
165
166extern int sysctl_legacy_va_layout;
167
168extern int page_is_ram(unsigned long pagenr);
169
170#endif /* __ASSEMBLY__ */
171
172#ifdef __ASSEMBLY__
173#define __PAGE_OFFSET CONFIG_PAGE_OFFSET
174#else
175#define __PAGE_OFFSET ((unsigned long)CONFIG_PAGE_OFFSET)
176#endif
177
178
179#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
180#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
181#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
182#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
183/* __pa_symbol should be used for C visible symbols.
184 This seems to be the official gcc blessed way to do such arithmetic. */
185#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
186#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
187#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
188#ifdef CONFIG_FLATMEM
189#define pfn_valid(pfn) ((pfn) < max_mapnr)
190#endif /* CONFIG_FLATMEM */
191#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
192
193#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
194
195#define VM_DATA_DEFAULT_FLAGS \
196 (VM_READ | VM_WRITE | \
197 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
198 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
199
200#include <asm-generic/memory_model.h>
201#include <asm-generic/page.h>
202
203#define __HAVE_ARCH_GATE_AREA 1
204#endif /* __KERNEL__ */
205
206#endif /* _I386_PAGE_H */