diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-i386/page.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-i386/page.h')
-rw-r--r-- | include/asm-i386/page.h | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h new file mode 100644 index 000000000000..ed13969fa2d6 --- /dev/null +++ b/include/asm-i386/page.h | |||
@@ -0,0 +1,153 @@ | |||
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 | #include <linux/config.h> | ||
16 | |||
17 | #ifdef CONFIG_X86_USE_3DNOW | ||
18 | |||
19 | #include <asm/mmx.h> | ||
20 | |||
21 | #define clear_page(page) mmx_clear_page((void *)(page)) | ||
22 | #define copy_page(to,from) mmx_copy_page(to,from) | ||
23 | |||
24 | #else | ||
25 | |||
26 | /* | ||
27 | * On older X86 processors it's not a win to use MMX here it seems. | ||
28 | * Maybe the K6-III ? | ||
29 | */ | ||
30 | |||
31 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | ||
32 | #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) | ||
33 | |||
34 | #endif | ||
35 | |||
36 | #define clear_user_page(page, vaddr, pg) clear_page(page) | ||
37 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
38 | |||
39 | #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) | ||
40 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | ||
41 | |||
42 | /* | ||
43 | * These are used to make use of C type-checking.. | ||
44 | */ | ||
45 | extern int nx_enabled; | ||
46 | #ifdef CONFIG_X86_PAE | ||
47 | extern unsigned long long __supported_pte_mask; | ||
48 | typedef struct { unsigned long pte_low, pte_high; } pte_t; | ||
49 | typedef struct { unsigned long long pmd; } pmd_t; | ||
50 | typedef struct { unsigned long long pgd; } pgd_t; | ||
51 | typedef struct { unsigned long long pgprot; } pgprot_t; | ||
52 | #define pmd_val(x) ((x).pmd) | ||
53 | #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) | ||
54 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
55 | #define HPAGE_SHIFT 21 | ||
56 | #else | ||
57 | typedef struct { unsigned long pte_low; } pte_t; | ||
58 | typedef struct { unsigned long pgd; } pgd_t; | ||
59 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
60 | #define boot_pte_t pte_t /* or would you rather have a typedef */ | ||
61 | #define pte_val(x) ((x).pte_low) | ||
62 | #define HPAGE_SHIFT 22 | ||
63 | #endif | ||
64 | #define PTE_MASK PAGE_MASK | ||
65 | |||
66 | #ifdef CONFIG_HUGETLB_PAGE | ||
67 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | ||
68 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | ||
69 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | ||
70 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | ||
71 | #endif | ||
72 | |||
73 | #define pgd_val(x) ((x).pgd) | ||
74 | #define pgprot_val(x) ((x).pgprot) | ||
75 | |||
76 | #define __pte(x) ((pte_t) { (x) } ) | ||
77 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
78 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
79 | |||
80 | #endif /* !__ASSEMBLY__ */ | ||
81 | |||
82 | /* to align the pointer to the (next) page boundary */ | ||
83 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | ||
84 | |||
85 | /* | ||
86 | * This handles the memory map.. We could make this a config | ||
87 | * option, but too many people screw it up, and too few need | ||
88 | * it. | ||
89 | * | ||
90 | * A __PAGE_OFFSET of 0xC0000000 means that the kernel has | ||
91 | * a virtual address space of one gigabyte, which limits the | ||
92 | * amount of physical memory you can use to about 950MB. | ||
93 | * | ||
94 | * If you want more physical memory than this then see the CONFIG_HIGHMEM4G | ||
95 | * and CONFIG_HIGHMEM64G options in the kernel configuration. | ||
96 | */ | ||
97 | |||
98 | #ifndef __ASSEMBLY__ | ||
99 | |||
100 | /* | ||
101 | * This much address space is reserved for vmalloc() and iomap() | ||
102 | * as well as fixmap mappings. | ||
103 | */ | ||
104 | extern unsigned int __VMALLOC_RESERVE; | ||
105 | |||
106 | /* Pure 2^n version of get_order */ | ||
107 | static __inline__ int get_order(unsigned long size) | ||
108 | { | ||
109 | int order; | ||
110 | |||
111 | size = (size-1) >> (PAGE_SHIFT-1); | ||
112 | order = -1; | ||
113 | do { | ||
114 | size >>= 1; | ||
115 | order++; | ||
116 | } while (size); | ||
117 | return order; | ||
118 | } | ||
119 | |||
120 | extern int sysctl_legacy_va_layout; | ||
121 | |||
122 | #endif /* __ASSEMBLY__ */ | ||
123 | |||
124 | #ifdef __ASSEMBLY__ | ||
125 | #define __PAGE_OFFSET (0xC0000000) | ||
126 | #else | ||
127 | #define __PAGE_OFFSET (0xC0000000UL) | ||
128 | #endif | ||
129 | |||
130 | |||
131 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) | ||
132 | #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) | ||
133 | #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) | ||
134 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) | ||
135 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) | ||
136 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | ||
137 | #ifndef CONFIG_DISCONTIGMEM | ||
138 | #define pfn_to_page(pfn) (mem_map + (pfn)) | ||
139 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | ||
140 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | ||
141 | #endif /* !CONFIG_DISCONTIGMEM */ | ||
142 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | ||
143 | |||
144 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
145 | |||
146 | #define VM_DATA_DEFAULT_FLAGS \ | ||
147 | (VM_READ | VM_WRITE | \ | ||
148 | ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ | ||
149 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
150 | |||
151 | #endif /* __KERNEL__ */ | ||
152 | |||
153 | #endif /* _I386_PAGE_H */ | ||