x86: no robust/pi futex for real i386 CPUs
authorThomas Gleixner <tglx@linutronix.de>
Sat, 16 Feb 2008 13:05:01 +0000 (14:05 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 26 Feb 2008 11:56:06 +0000 (12:56 +0100)
Real i386 CPUs do not have cmpxchg instructions. Catch it before
crashing on an invalid opcode.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/asm-x86/futex.h

index cd9f894dd2d7c778fe4d85fdeb0f83168a16804d..c9952ea9f6980cdb3620470ff285c59e28f8acd2 100644 (file)
@@ -102,6 +102,13 @@ futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
 static inline int
 futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
 {
+
+#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
+       /* Real i386 machines have no cmpxchg instruction */
+       if (boot_cpu_data.x86 == 3)
+               return -ENOSYS;
+#endif
+
        if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
                return -EFAULT;