aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2006-02-08 16:19:37 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-02-08 16:19:37 -0500
commit49bca4c2815feafd5f999bf43baf87e0dd8d1d08 (patch)
tree6bc9a59e2fa217d346841418fd45dd704cf61071
parent99595d0237926b5aba1fe4c844a011a1ba1ee1f8 (diff)
[ARM] 3309/1: disable the pre-ARMv5 NPTL kernel helper in the non MMU case
Patch from Nicolas Pitre The cmpxchg emulation on pre-ARMv5 relies on user code executed from a kernel address. If the operation cannot complete atomically, it is aborted from the usr_entry macro by clearing the Z flag. This clearing of the Z flag is done whenever the user pc is above TASK_SIZE. However this "pc >= TASK_SIZE" test cannot work in the non MMU case. Worse: the current code will corrupt the Z flag on every entry to the kernel. Let's disable it in the non MMU case for now. Using NPTL on non MMU targets needs to be worked out anyway. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/kernel/entry-armv.S10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d401d908c463..f248bbfe745f 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -333,10 +333,14 @@ __pabt_svc:
333 @ from the exception stack 333 @ from the exception stack
334 334
335#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) 335#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
336#ifndef CONFIG_MMU
337#warning "NPTL on non MMU needs fixing"
338#else
336 @ make sure our user space atomic helper is aborted 339 @ make sure our user space atomic helper is aborted
337 cmp r2, #TASK_SIZE 340 cmp r2, #TASK_SIZE
338 bichs r3, r3, #PSR_Z_BIT 341 bichs r3, r3, #PSR_Z_BIT
339#endif 342#endif
343#endif
340 344
341 @ 345 @
342 @ We are now ready to fill in the remaining blanks on the stack: 346 @ We are now ready to fill in the remaining blanks on the stack:
@@ -756,12 +760,18 @@ __kuser_cmpxchg: @ 0xffff0fc0
756 * exception happening just after the str instruction which would 760 * exception happening just after the str instruction which would
757 * clear the Z flag although the exchange was done. 761 * clear the Z flag although the exchange was done.
758 */ 762 */
763#ifdef CONFIG_MMU
759 teq ip, ip @ set Z flag 764 teq ip, ip @ set Z flag
760 ldr ip, [r2] @ load current val 765 ldr ip, [r2] @ load current val
761 add r3, r2, #1 @ prepare store ptr 766 add r3, r2, #1 @ prepare store ptr
762 teqeq ip, r0 @ compare with oldval if still allowed 767 teqeq ip, r0 @ compare with oldval if still allowed
763 streq r1, [r3, #-1]! @ store newval if still allowed 768 streq r1, [r3, #-1]! @ store newval if still allowed
764 subs r0, r2, r3 @ if r2 == r3 the str occured 769 subs r0, r2, r3 @ if r2 == r3 the str occured
770#else
771#warning "NPTL on non MMU needs fixing"
772 mov r0, #-1
773 adds r0, r0, #0
774#endif
765 mov pc, lr 775 mov pc, lr
766 776
767#else 777#else