diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-14 10:29:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-14 10:29:29 -0400 |
commit | 7ac992ef615c66a05ebb831915935e83c0ec8e05 (patch) | |
tree | 0bef479fccb4e73733fab628dc525a5959bba925 /arch | |
parent | 6a251b0ab67989f468f4cb65179e0cf40cf8c295 (diff) | |
parent | a5e48b88da225580394f825ffe67e444b050074b (diff) |
Merge branch 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze
* 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze:
microblaze: Fix module loading on system with WB cache
microblaze: export assembly functions used by modules
microblaze: Remove powerpc code from Microblaze port
microblaze: Remove compilation warnings in cache macro
microblaze: export assembly functions used by modules
microblaze: fix get_user/put_user side-effects
microblaze: re-enable interrupts before calling schedule
Diffstat (limited to 'arch')
-rw-r--r-- | arch/microblaze/include/asm/uaccess.h | 87 | ||||
-rw-r--r-- | arch/microblaze/kernel/cpu/cache.c | 3 | ||||
-rw-r--r-- | arch/microblaze/kernel/entry-nommu.S | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/microblaze_ksyms.c | 11 | ||||
-rw-r--r-- | arch/microblaze/kernel/module.c | 2 | ||||
-rw-r--r-- | arch/microblaze/mm/init.c | 1 | ||||
-rw-r--r-- | arch/microblaze/mm/pgtable.c | 1 | ||||
-rw-r--r-- | arch/microblaze/pci/pci-common.c | 2 |
8 files changed, 89 insertions, 20 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 446bec29b142..26460d15b338 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -182,6 +182,39 @@ extern long __user_bad(void); | |||
182 | * Returns zero on success, or -EFAULT on error. | 182 | * Returns zero on success, or -EFAULT on error. |
183 | * On error, the variable @x is set to zero. | 183 | * On error, the variable @x is set to zero. |
184 | */ | 184 | */ |
185 | #define get_user(x, ptr) \ | ||
186 | __get_user_check((x), (ptr), sizeof(*(ptr))) | ||
187 | |||
188 | #define __get_user_check(x, ptr, size) \ | ||
189 | ({ \ | ||
190 | unsigned long __gu_val = 0; \ | ||
191 | const typeof(*(ptr)) __user *__gu_addr = (ptr); \ | ||
192 | int __gu_err = 0; \ | ||
193 | \ | ||
194 | if (access_ok(VERIFY_READ, __gu_addr, size)) { \ | ||
195 | switch (size) { \ | ||
196 | case 1: \ | ||
197 | __get_user_asm("lbu", __gu_addr, __gu_val, \ | ||
198 | __gu_err); \ | ||
199 | break; \ | ||
200 | case 2: \ | ||
201 | __get_user_asm("lhu", __gu_addr, __gu_val, \ | ||
202 | __gu_err); \ | ||
203 | break; \ | ||
204 | case 4: \ | ||
205 | __get_user_asm("lw", __gu_addr, __gu_val, \ | ||
206 | __gu_err); \ | ||
207 | break; \ | ||
208 | default: \ | ||
209 | __gu_err = __user_bad(); \ | ||
210 | break; \ | ||
211 | } \ | ||
212 | } else { \ | ||
213 | __gu_err = -EFAULT; \ | ||
214 | } \ | ||
215 | x = (typeof(*(ptr)))__gu_val; \ | ||
216 | __gu_err; \ | ||
217 | }) | ||
185 | 218 | ||
186 | #define __get_user(x, ptr) \ | 219 | #define __get_user(x, ptr) \ |
187 | ({ \ | 220 | ({ \ |
@@ -206,12 +239,6 @@ extern long __user_bad(void); | |||
206 | }) | 239 | }) |
207 | 240 | ||
208 | 241 | ||
209 | #define get_user(x, ptr) \ | ||
210 | ({ \ | ||
211 | access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \ | ||
212 | ? __get_user((x), (ptr)) : -EFAULT; \ | ||
213 | }) | ||
214 | |||
215 | #define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ | 242 | #define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ |
216 | ({ \ | 243 | ({ \ |
217 | __asm__ __volatile__ ( \ | 244 | __asm__ __volatile__ ( \ |
@@ -266,6 +293,42 @@ extern long __user_bad(void); | |||
266 | * | 293 | * |
267 | * Returns zero on success, or -EFAULT on error. | 294 | * Returns zero on success, or -EFAULT on error. |
268 | */ | 295 | */ |
296 | #define put_user(x, ptr) \ | ||
297 | __put_user_check((x), (ptr), sizeof(*(ptr))) | ||
298 | |||
299 | #define __put_user_check(x, ptr, size) \ | ||
300 | ({ \ | ||
301 | typeof(*(ptr)) __pu_val; \ | ||
302 | typeof(*(ptr)) __user *__pu_addr = (ptr); \ | ||
303 | int __pu_err = 0; \ | ||
304 | \ | ||
305 | __pu_val = (x); \ | ||
306 | if (access_ok(VERIFY_WRITE, __pu_addr, size)) { \ | ||
307 | switch (size) { \ | ||
308 | case 1: \ | ||
309 | __put_user_asm("sb", __pu_addr, __pu_val, \ | ||
310 | __pu_err); \ | ||
311 | break; \ | ||
312 | case 2: \ | ||
313 | __put_user_asm("sh", __pu_addr, __pu_val, \ | ||
314 | __pu_err); \ | ||
315 | break; \ | ||
316 | case 4: \ | ||
317 | __put_user_asm("sw", __pu_addr, __pu_val, \ | ||
318 | __pu_err); \ | ||
319 | break; \ | ||
320 | case 8: \ | ||
321 | __put_user_asm_8(__pu_addr, __pu_val, __pu_err);\ | ||
322 | break; \ | ||
323 | default: \ | ||
324 | __pu_err = __user_bad(); \ | ||
325 | break; \ | ||
326 | } \ | ||
327 | } else { \ | ||
328 | __pu_err = -EFAULT; \ | ||
329 | } \ | ||
330 | __pu_err; \ | ||
331 | }) | ||
269 | 332 | ||
270 | #define __put_user(x, ptr) \ | 333 | #define __put_user(x, ptr) \ |
271 | ({ \ | 334 | ({ \ |
@@ -290,18 +353,6 @@ extern long __user_bad(void); | |||
290 | __gu_err; \ | 353 | __gu_err; \ |
291 | }) | 354 | }) |
292 | 355 | ||
293 | #ifndef CONFIG_MMU | ||
294 | |||
295 | #define put_user(x, ptr) __put_user((x), (ptr)) | ||
296 | |||
297 | #else /* CONFIG_MMU */ | ||
298 | |||
299 | #define put_user(x, ptr) \ | ||
300 | ({ \ | ||
301 | access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \ | ||
302 | ? __put_user((x), (ptr)) : -EFAULT; \ | ||
303 | }) | ||
304 | #endif /* CONFIG_MMU */ | ||
305 | 356 | ||
306 | /* copy_to_from_user */ | 357 | /* copy_to_from_user */ |
307 | #define __copy_from_user(to, from, n) \ | 358 | #define __copy_from_user(to, from, n) \ |
diff --git a/arch/microblaze/kernel/cpu/cache.c b/arch/microblaze/kernel/cpu/cache.c index 21c3a92394de..109876e8d643 100644 --- a/arch/microblaze/kernel/cpu/cache.c +++ b/arch/microblaze/kernel/cpu/cache.c | |||
@@ -137,8 +137,9 @@ do { \ | |||
137 | do { \ | 137 | do { \ |
138 | int step = -line_length; \ | 138 | int step = -line_length; \ |
139 | int align = ~(line_length - 1); \ | 139 | int align = ~(line_length - 1); \ |
140 | int count; \ | ||
140 | end = ((end & align) == end) ? end - line_length : end & align; \ | 141 | end = ((end & align) == end) ? end - line_length : end & align; \ |
141 | int count = end - start; \ | 142 | count = end - start; \ |
142 | WARN_ON(count < 0); \ | 143 | WARN_ON(count < 0); \ |
143 | \ | 144 | \ |
144 | __asm__ __volatile__ (" 1: " #op " %0, %1; \ | 145 | __asm__ __volatile__ (" 1: " #op " %0, %1; \ |
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S index 391d6197fc3b..8cc18cd2cce6 100644 --- a/arch/microblaze/kernel/entry-nommu.S +++ b/arch/microblaze/kernel/entry-nommu.S | |||
@@ -476,6 +476,8 @@ ENTRY(ret_from_fork) | |||
476 | nop | 476 | nop |
477 | 477 | ||
478 | work_pending: | 478 | work_pending: |
479 | enable_irq | ||
480 | |||
479 | andi r11, r19, _TIF_NEED_RESCHED | 481 | andi r11, r19, _TIF_NEED_RESCHED |
480 | beqi r11, 1f | 482 | beqi r11, 1f |
481 | bralid r15, schedule | 483 | bralid r15, schedule |
diff --git a/arch/microblaze/kernel/microblaze_ksyms.c b/arch/microblaze/kernel/microblaze_ksyms.c index bc4dcb7d3861..ff85f7718035 100644 --- a/arch/microblaze/kernel/microblaze_ksyms.c +++ b/arch/microblaze/kernel/microblaze_ksyms.c | |||
@@ -52,3 +52,14 @@ EXPORT_SYMBOL_GPL(_ebss); | |||
52 | extern void _mcount(void); | 52 | extern void _mcount(void); |
53 | EXPORT_SYMBOL(_mcount); | 53 | EXPORT_SYMBOL(_mcount); |
54 | #endif | 54 | #endif |
55 | |||
56 | /* | ||
57 | * Assembly functions that may be used (directly or indirectly) by modules | ||
58 | */ | ||
59 | EXPORT_SYMBOL(__copy_tofrom_user); | ||
60 | EXPORT_SYMBOL(__strncpy_user); | ||
61 | |||
62 | #ifdef CONFIG_OPT_LIB_ASM | ||
63 | EXPORT_SYMBOL(memcpy); | ||
64 | EXPORT_SYMBOL(memmove); | ||
65 | #endif | ||
diff --git a/arch/microblaze/kernel/module.c b/arch/microblaze/kernel/module.c index cbecf110dc30..0e73f6606547 100644 --- a/arch/microblaze/kernel/module.c +++ b/arch/microblaze/kernel/module.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | 17 | ||
18 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
19 | #include <asm/cacheflush.h> | ||
19 | 20 | ||
20 | void *module_alloc(unsigned long size) | 21 | void *module_alloc(unsigned long size) |
21 | { | 22 | { |
@@ -151,6 +152,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | |||
151 | int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, | 152 | int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, |
152 | struct module *module) | 153 | struct module *module) |
153 | { | 154 | { |
155 | flush_dcache(); | ||
154 | return 0; | 156 | return 0; |
155 | } | 157 | } |
156 | 158 | ||
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index f42c2dde8b1c..cca3579d4268 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c | |||
@@ -47,6 +47,7 @@ unsigned long memory_start; | |||
47 | EXPORT_SYMBOL(memory_start); | 47 | EXPORT_SYMBOL(memory_start); |
48 | unsigned long memory_end; /* due to mm/nommu.c */ | 48 | unsigned long memory_end; /* due to mm/nommu.c */ |
49 | unsigned long memory_size; | 49 | unsigned long memory_size; |
50 | EXPORT_SYMBOL(memory_size); | ||
50 | 51 | ||
51 | /* | 52 | /* |
52 | * paging_init() sets up the page tables - in fact we've already done this. | 53 | * paging_init() sets up the page tables - in fact we've already done this. |
diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c index 784557fb28cf..59bf2335a4ce 100644 --- a/arch/microblaze/mm/pgtable.c +++ b/arch/microblaze/mm/pgtable.c | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | unsigned long ioremap_base; | 43 | unsigned long ioremap_base; |
44 | unsigned long ioremap_bot; | 44 | unsigned long ioremap_bot; |
45 | EXPORT_SYMBOL(ioremap_bot); | ||
45 | 46 | ||
46 | /* The maximum lowmem defaults to 768Mb, but this can be configured to | 47 | /* The maximum lowmem defaults to 768Mb, but this can be configured to |
47 | * another value. | 48 | * another value. |
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 01c8c97c15b7..9cb782b8e036 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -1507,7 +1507,7 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus) | |||
1507 | pci_bus_add_devices(bus); | 1507 | pci_bus_add_devices(bus); |
1508 | 1508 | ||
1509 | /* Fixup EEH */ | 1509 | /* Fixup EEH */ |
1510 | eeh_add_device_tree_late(bus); | 1510 | /* eeh_add_device_tree_late(bus); */ |
1511 | } | 1511 | } |
1512 | EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); | 1512 | EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); |
1513 | 1513 | ||