lightweight robust futexes: i386
In-Reply-To: <[email protected]>
Quoted 11 lines · Ingo Molnar
include/asm-i386/futex.h +4
-1@@ -107,7 +107,25 @@ futex_atomic_op_inuser (int encoded_op,static inline int futex_atomic_cmpxchg_inuser (int __user *uaddr,int oldval,int newval) { -return -ENOSYS ; + __asm__ __volatile__( +"1: " LOCK_PREFIX "cmpxchgl %3, %1 \n" + + "2: .section .fixup, \"ax\" \n"
include/asm-i386/futex.h futex_atomic_op_inuser (int encoded_op, · line 123
Quoted 10 lines
include/asm-i386/futex.h +10
-0+"3: mov %2, %0 \n" +" jmp 2b \n" +" .previous \n" + +" .section __ex_table, \"a\" \n" +" .align 8 \n" +" .long 1b,3b \n" +" .previous \n" + + : "=a" (oldval), "=m" (*uaddr)
^^^^
Should be "+m" because it's both read and written.
include/asm-i386/futex.h futex_atomic_op_inuser (int encoded_op, · line 125
Quoted 2 lines
include/asm-i386/futex.h +2
-0+ : "i" (-EFAULT), "r" (newval), "0" (oldval) + : "memory"
^^^^^^^^
Is this necessary? Every possible memory location that could be
affected has been listed in the operands if the above change is made.
Quoted 6 lines
include/asm-i386/futex.h +3
-0+ ); + + return oldval; }#endif
Signature · 2 lines
Chuck "Equations are the Devil's sentences." --Stephen Colbert
Quoted 3 lines · Chuck Ebbert
Quoted 1 line
+ : "=a" (oldval), "=m" (*uaddr)
^^^^Should be "+m" because it's both read and written.
No, this is why there is the "0" input parameter.
\> > + : "memory"
Quoted 3 lines
^^^^^^^^Is this necessary? Every possible memory location that could be
affected has been listed in the operands if the above change is made.
This makes the asm a barrier for the compiler.