diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-01-30 07:32:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:42 -0500 |
commit | 345b904c3f7c24fbfadfee7cddd5896d13b176d9 (patch) | |
tree | 4911361d43625a3d05e29149186ec286c3e5f1e7 /include/asm-x86/page.h | |
parent | 83a5101bf2fa7dcf09ffd436078a021d32c97f85 (diff) |
x86: page.h: unify page copying and clearing
# HG changeset patch
# User Jeremy Fitzhardinge <jeremy@xensource.com>
# Date 1199317362 28800
# Node ID 4d9a413a0f4c1d98dbea704f0366457b5117045d
# Parent ba0ec40a50a7aef1a3153cea124c35e261f5a2df
x86: page.h: unify page copying and clearing
Move, and to some extent unify, the various page copying and clearing
functions. The only unification here is that both architectures use
the same function for copying/clearing user and kernel pages.
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>
Diffstat (limited to 'include/asm-x86/page.h')
-rw-r--r-- | include/asm-x86/page.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index e0fa4a032ea7..2ebb6977e00c 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h | |||
@@ -70,6 +70,11 @@ | |||
70 | #define KERNEL_TEXT_SIZE (40*1024*1024) | 70 | #define KERNEL_TEXT_SIZE (40*1024*1024) |
71 | #define KERNEL_TEXT_START _AC(0xffffffff80000000, UL) | 71 | #define KERNEL_TEXT_START _AC(0xffffffff80000000, UL) |
72 | 72 | ||
73 | #ifndef __ASSEMBLY__ | ||
74 | void clear_page(void *page); | ||
75 | void copy_page(void *to, void *from); | ||
76 | #endif /* !__ASSEMBLY__ */ | ||
77 | |||
73 | #endif /* CONFIG_X86_64 */ | 78 | #endif /* CONFIG_X86_64 */ |
74 | 79 | ||
75 | #ifdef CONFIG_X86_32 | 80 | #ifdef CONFIG_X86_32 |
@@ -98,6 +103,34 @@ | |||
98 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | 103 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
99 | #endif | 104 | #endif |
100 | 105 | ||
106 | #ifndef __ASSEMBLY__ | ||
107 | #ifdef CONFIG_X86_USE_3DNOW | ||
108 | #include <asm/mmx.h> | ||
109 | |||
110 | static inline void clear_page(void *page) | ||
111 | { | ||
112 | mmx_clear_page(page); | ||
113 | } | ||
114 | |||
115 | static inline void copy_page(void *to, void *from) | ||
116 | { | ||
117 | mmx_copy_page(to, from); | ||
118 | } | ||
119 | #else /* !CONFIG_X86_USE_3DNOW */ | ||
120 | #include <linux/string.h> | ||
121 | |||
122 | static inline void clear_page(void *page) | ||
123 | { | ||
124 | memset(page, 0, PAGE_SIZE); | ||
125 | } | ||
126 | |||
127 | static inline void copy_page(void *to, void *from) | ||
128 | { | ||
129 | memcpy(to, from, PAGE_SIZE); | ||
130 | } | ||
131 | #endif /* CONFIG_X86_3DNOW */ | ||
132 | #endif /* !__ASSEMBLY__ */ | ||
133 | |||
101 | #endif /* CONFIG_X86_32 */ | 134 | #endif /* CONFIG_X86_32 */ |
102 | 135 | ||
103 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) | 136 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) |
@@ -107,6 +140,28 @@ | |||
107 | VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | 140 | VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
108 | 141 | ||
109 | 142 | ||
143 | #ifndef __ASSEMBLY__ | ||
144 | struct page; | ||
145 | |||
146 | static void inline clear_user_page(void *page, unsigned long vaddr, | ||
147 | struct page *pg) | ||
148 | { | ||
149 | clear_page(page); | ||
150 | } | ||
151 | |||
152 | static void inline copy_user_page(void *to, void *from, unsigned long vaddr, | ||
153 | struct page *topage) | ||
154 | { | ||
155 | copy_page(to, from); | ||
156 | } | ||
157 | |||
158 | #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \ | ||
159 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) | ||
160 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | ||
161 | |||
162 | #endif /* __ASSEMBLY__ */ | ||
163 | |||
164 | |||
110 | #ifdef CONFIG_X86_32 | 165 | #ifdef CONFIG_X86_32 |
111 | # include "page_32.h" | 166 | # include "page_32.h" |
112 | #else | 167 | #else |