Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[sfrench/cifs-2.6.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_X86_PAE
17 #define __PHYSICAL_MASK_SHIFT   36
18 #define __VIRTUAL_MASK_SHIFT    32
19 #define PAGETABLE_LEVELS        3
20
21 #ifndef __ASSEMBLY__
22 typedef u64     pteval_t;
23 typedef u64     pmdval_t;
24 typedef u64     pudval_t;
25 typedef u64     pgdval_t;
26 typedef u64     pgprotval_t;
27 typedef u64     phys_addr_t;
28
29 typedef union {
30         struct {
31                 unsigned long pte_low, pte_high;
32         };
33         pteval_t pte;
34 } pte_t;
35 #endif  /* __ASSEMBLY__
36  */
37 #else  /* !CONFIG_X86_PAE */
38 #define __PHYSICAL_MASK_SHIFT   32
39 #define __VIRTUAL_MASK_SHIFT    32
40 #define PAGETABLE_LEVELS        2
41
42 #ifndef __ASSEMBLY__
43 typedef unsigned long   pteval_t;
44 typedef unsigned long   pmdval_t;
45 typedef unsigned long   pudval_t;
46 typedef unsigned long   pgdval_t;
47 typedef unsigned long   pgprotval_t;
48 typedef unsigned long   phys_addr_t;
49
50 typedef union { pteval_t pte, pte_low; } pte_t;
51 typedef pte_t boot_pte_t;
52
53 typedef struct page *pgtable_t;
54
55 #endif  /* __ASSEMBLY__ */
56 #endif  /* CONFIG_X86_PAE */
57
58 #ifdef CONFIG_HUGETLB_PAGE
59 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
60 #endif
61
62 #ifndef __ASSEMBLY__
63 #define __phys_addr(x)          ((x)-PAGE_OFFSET)
64 #define __phys_reloc_hide(x)    RELOC_HIDE((x), 0)
65
66 #ifdef CONFIG_FLATMEM
67 #define pfn_valid(pfn)          ((pfn) < max_mapnr)
68 #endif /* CONFIG_FLATMEM */
69
70 extern int nx_enabled;
71
72 /*
73  * This much address space is reserved for vmalloc() and iomap()
74  * as well as fixmap mappings.
75  */
76 extern unsigned int __VMALLOC_RESERVE;
77 extern int sysctl_legacy_va_layout;
78
79 #define VMALLOC_RESERVE         ((unsigned long)__VMALLOC_RESERVE)
80 #define MAXMEM                  (-__PAGE_OFFSET-__VMALLOC_RESERVE)
81
82 #ifdef CONFIG_X86_USE_3DNOW
83 #include <asm/mmx.h>
84
85 static inline void clear_page(void *page)
86 {
87         mmx_clear_page(page);
88 }
89
90 static inline void copy_page(void *to, void *from)
91 {
92         mmx_copy_page(to, from);
93 }
94 #else  /* !CONFIG_X86_USE_3DNOW */
95 #include <linux/string.h>
96
97 static inline void clear_page(void *page)
98 {
99         memset(page, 0, PAGE_SIZE);
100 }
101
102 static inline void copy_page(void *to, void *from)
103 {
104         memcpy(to, from, PAGE_SIZE);
105 }
106 #endif  /* CONFIG_X86_3DNOW */
107 #endif  /* !__ASSEMBLY__ */
108
109 #endif /* _ASM_X86_PAGE_32_H */