aboutsummaryrefslogtreecommitdiffstats
path: root/include
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
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')
-rw-r--r--include/asm-x86/futex_32.h64
-rw-r--r--include/asm-x86/futex_64.h24
2 files changed, 44 insertions, 44 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)
diff --git a/include/asm-x86/futex_64.h b/include/asm-x86/futex_64.h
index 5cdfb08013c3..02964d225d18 100644
--- a/include/asm-x86/futex_64.h
+++ b/include/asm-x86/futex_64.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/uaccess.h> 11#include <asm/uaccess.h>
@@ -16,13 +18,13 @@
16 jmp 2b\n\ 18 jmp 2b\n\
17 .previous\n\ 19 .previous\n\
18 .section __ex_table,\"a\"\n\ 20 .section __ex_table,\"a\"\n\
19 .align 8\n\ 21 .align 8\n" \
20 .quad 1b,3b\n\ 22 _ASM_PTR "1b,3b\n \
21 .previous" \ 23 .previous" \
22 : "=r" (oldval), "=r" (ret), "=m" (*uaddr) \ 24 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \
23 : "i" (-EFAULT), "m" (*uaddr), "0" (oparg), "1" (0)) 25 : "i" (-EFAULT), "0" (oparg), "1" (0))
24 26
25#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \ 27#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
26 __asm__ __volatile ( \ 28 __asm__ __volatile ( \
27"1: movl %2, %0\n\ 29"1: movl %2, %0\n\
28 movl %0, %3\n" \ 30 movl %0, %3\n" \
@@ -34,12 +36,12 @@
34 jmp 3b\n\ 36 jmp 3b\n\
35 .previous\n\ 37 .previous\n\
36 .section __ex_table,\"a\"\n\ 38 .section __ex_table,\"a\"\n\
37 .align 8\n\ 39 .align 8\n" \
38 .quad 1b,4b,2b,4b\n\ 40 _ASM_PTR "1b,4b,2b,4b\n \
39 .previous" \ 41 .previous" \
40 : "=&a" (oldval), "=&r" (ret), "=m" (*uaddr), \ 42 : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \
41 "=&r" (tem) \ 43 "=&r" (tem) \
42 : "r" (oparg), "i" (-EFAULT), "m" (*uaddr), "1" (0)) 44 : "r" (oparg), "i" (-EFAULT), "1" (0))
43 45
44static inline int 46static inline int
45futex_atomic_op_inuser (int encoded_op, int __user *uaddr) 47futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
@@ -110,10 +112,10 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
110 112
111 " .section __ex_table, \"a\" \n" 113 " .section __ex_table, \"a\" \n"
112 " .align 8 \n" 114 " .align 8 \n"
113 " .quad 1b,3b \n" 115 _ASM_PTR " 1b,3b \n"
114 " .previous \n" 116 " .previous \n"
115 117
116 : "=a" (oldval), "=m" (*uaddr) 118 : "=a" (oldval), "+m" (*uaddr)
117 : "i" (-EFAULT), "r" (newval), "0" (oldval) 119 : "i" (-EFAULT), "r" (newval), "0" (oldval)
118 : "memory" 120 : "memory"
119 ); 121 );