Merge branches 'x86/xen', 'x86/build', 'x86/microcode', 'x86/mm-debug-v2', 'x86/memor...
[pandora-kernel.git] / include / asm-x86 / page_32.h
1 #ifndef ASM_X86__PAGE_32_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_4KSTACKS
17 #define THREAD_ORDER    0
18 #else
19 #define THREAD_ORDER    1
20 #endif
21 #define THREAD_SIZE     (PAGE_SIZE << THREAD_ORDER)
22
23
24 #ifdef CONFIG_X86_PAE
25 /* 44=32+12, the limit we can fit into an unsigned long pfn */
26 #define __PHYSICAL_MASK_SHIFT   44
27 #define __VIRTUAL_MASK_SHIFT    32
28 #define PAGETABLE_LEVELS        3
29
30 #ifndef __ASSEMBLY__
31 typedef u64     pteval_t;
32 typedef u64     pmdval_t;
33 typedef u64     pudval_t;
34 typedef u64     pgdval_t;
35 typedef u64     pgprotval_t;
36 typedef u64     phys_addr_t;
37
38 typedef union {
39         struct {
40                 unsigned long pte_low, pte_high;
41         };
42         pteval_t pte;
43 } pte_t;
44 #endif  /* __ASSEMBLY__
45  */
46 #else  /* !CONFIG_X86_PAE */
47 #define __PHYSICAL_MASK_SHIFT   32
48 #define __VIRTUAL_MASK_SHIFT    32
49 #define PAGETABLE_LEVELS        2
50
51 #ifndef __ASSEMBLY__
52 typedef unsigned long   pteval_t;
53 typedef unsigned long   pmdval_t;
54 typedef unsigned long   pudval_t;
55 typedef unsigned long   pgdval_t;
56 typedef unsigned long   pgprotval_t;
57 typedef unsigned long   phys_addr_t;
58
59 typedef union {
60         pteval_t pte;
61         pteval_t pte_low;
62 } pte_t;
63
64 #endif  /* __ASSEMBLY__ */
65 #endif  /* CONFIG_X86_PAE */
66
67 #ifndef __ASSEMBLY__
68 typedef struct page *pgtable_t;
69 #endif
70
71 #ifdef CONFIG_HUGETLB_PAGE
72 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
73 #endif
74
75 #ifndef __ASSEMBLY__
76 #define __phys_addr_const(x)    ((x) - PAGE_OFFSET)
77 #ifdef CONFIG_DEBUG_VIRTUAL
78 extern unsigned long __phys_addr(unsigned long);
79 #else
80 #define __phys_addr(x)          ((x) - PAGE_OFFSET)
81 #endif
82 #define __phys_reloc_hide(x)    RELOC_HIDE((x), 0)
83
84 #ifdef CONFIG_FLATMEM
85 #define pfn_valid(pfn)          ((pfn) < max_mapnr)
86 #endif /* CONFIG_FLATMEM */
87
88 extern int nx_enabled;
89
90 /*
91  * This much address space is reserved for vmalloc() and iomap()
92  * as well as fixmap mappings.
93  */
94 extern unsigned int __VMALLOC_RESERVE;
95 extern int sysctl_legacy_va_layout;
96
97 extern void find_low_pfn_range(void);
98 extern unsigned long init_memory_mapping(unsigned long start,
99                                          unsigned long end);
100 extern void initmem_init(unsigned long, unsigned long);
101 extern void free_initmem(void);
102 extern void setup_bootmem_allocator(void);
103
104
105 #ifdef CONFIG_X86_USE_3DNOW
106 #include <asm/mmx.h>
107
108 static inline void clear_page(void *page)
109 {
110         mmx_clear_page(page);
111 }
112
113 static inline void copy_page(void *to, void *from)
114 {
115         mmx_copy_page(to, from);
116 }
117 #else  /* !CONFIG_X86_USE_3DNOW */
118 #include <linux/string.h>
119
120 static inline void clear_page(void *page)
121 {
122         memset(page, 0, PAGE_SIZE);
123 }
124
125 static inline void copy_page(void *to, void *from)
126 {
127         memcpy(to, from, PAGE_SIZE);
128 }
129 #endif  /* CONFIG_X86_3DNOW */
130 #endif  /* !__ASSEMBLY__ */
131
132 #endif /* ASM_X86__PAGE_32_H */