aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/futex_32.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-01-30 07:30:20 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:20 -0500
commit2f2239d1d53b06dd475634f79e1905f3775fcedc (patch)
treea87fbd88a1ce57b6a477dbe5a66ce0ca797780a2 /include/asm-x86/futex_32.h
parent0e078e2f5060e06f9b3f32e55665ea835343440e (diff)
x86: prepare merging futex_32/64.h
Replace .quad/.long with a define and use the same asm syntax for i386 and x86. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/futex_32.h')
-rw-r--r--include/asm-x86/futex_32.h64
1 files changed, 31 insertions, 33 deletions
diff --git a/include/asm-x86/futex_32.h b/include/asm-x86/futex_32.h
index 438ef0ec7101..c80013e19c21 100644
--- a/include/asm-x86/futex_32.h
+++ b/include/asm-x86/futex_32.h
@@ -4,6 +4,8 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/futex.h> 6#include <linux/futex.h>
7
8#include <asm/asm.h>
7#include <asm/errno.h> 9#include <asm/errno.h>
8#include <asm/system.h> 10#include <asm/system.h>
9#include <asm/processor.h> 11#include <asm/processor.h>
@@ -17,13 +19,13 @@
17 jmp 2b\n\ 19 jmp 2b\n\
18 .previous\n\ 20 .previous\n\
19 .section __ex_table,\"a\"\n\ 21 .section __ex_table,\"a\"\n\
20 .align 8\n\ 22 .align 8\n" \
21 .long 1b,3b\n\ 23 _ASM_PTR "1b,3b\n \
22 .previous" \ 24 .previous" \
23 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \ 25 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \
24 : "i" (-EFAULT), "0" (oparg), "1" (0)) 26 : "i" (-EFAULT), "0" (oparg), "1" (0))
25 27
26#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \ 28#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
27 __asm__ __volatile ( \ 29 __asm__ __volatile ( \
28"1: movl %2, %0\n\ 30"1: movl %2, %0\n\
29 movl %0, %3\n" \ 31 movl %0, %3\n" \
@@ -35,8 +37,8 @@
35 jmp 3b\n\ 37 jmp 3b\n\
36 .previous\n\ 38 .previous\n\
37 .section __ex_table,\"a\"\n\ 39 .section __ex_table,\"a\"\n\
38 .align 8\n\ 40 .align 8\n" \
39 .long 1b,4b,2b,4b\n\ 41 _ASM_PTR "1b,4b,2b,4b\n \
40 .previous" \ 42 .previous" \
41 : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \ 43 : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \
42 "=&r" (tem) \ 44 "=&r" (tem) \
@@ -56,36 +58,32 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
56 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 58 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
57 return -EFAULT; 59 return -EFAULT;
58 60
61#ifndef CONFIG_X86_BSWAP
62 if (op == FUTEX_OP_SET && boot_cpu_data.x86 == 3)
63 return -ENOSYS;
64#endif
65
59 pagefault_disable(); 66 pagefault_disable();
60 67
61 if (op == FUTEX_OP_SET) 68 switch (op) {
69 case FUTEX_OP_SET:
62 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg); 70 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
63 else { 71 break;
64#ifndef CONFIG_X86_BSWAP 72 case FUTEX_OP_ADD:
65 if (boot_cpu_data.x86 == 3) 73 __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval,
66 ret = -ENOSYS; 74 uaddr, oparg);
67 else 75 break;
68#endif 76 case FUTEX_OP_OR:
69 switch (op) { 77 __futex_atomic_op2("orl %4, %3", ret, oldval, uaddr, oparg);
70 case FUTEX_OP_ADD: 78 break;
71 __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, 79 case FUTEX_OP_ANDN:
72 oldval, uaddr, oparg); 80 __futex_atomic_op2("andl %4, %3", ret, oldval, uaddr, ~oparg);
73 break; 81 break;
74 case FUTEX_OP_OR: 82 case FUTEX_OP_XOR:
75 __futex_atomic_op2("orl %4, %3", ret, oldval, uaddr, 83 __futex_atomic_op2("xorl %4, %3", ret, oldval, uaddr, oparg);
76 oparg); 84 break;
77 break; 85 default:
78 case FUTEX_OP_ANDN: 86 ret = -ENOSYS;
79 __futex_atomic_op2("andl %4, %3", ret, oldval, uaddr,
80 ~oparg);
81 break;
82 case FUTEX_OP_XOR:
83 __futex_atomic_op2("xorl %4, %3", ret, oldval, uaddr,
84 oparg);
85 break;
86 default:
87 ret = -ENOSYS;
88 }
89 } 87 }
90 88
91 pagefault_enable(); 89 pagefault_enable();
@@ -120,7 +118,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
120 118
121 " .section __ex_table, \"a\" \n" 119 " .section __ex_table, \"a\" \n"
122 " .align 8 \n" 120 " .align 8 \n"
123 " .long 1b,3b \n" 121 _ASM_PTR " 1b,3b \n"
124 " .previous \n" 122 " .previous \n"
125 123
126 : "=a" (oldval), "+m" (*uaddr) 124 : "=a" (oldval), "+m" (*uaddr)