~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/x86/include/asm/futex.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
                       "+m" (*uaddr), "=&r" (tem)               \
38
38
                     : "r" (oparg), "i" (-EFAULT), "1" (0))
39
39
 
40
 
static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
 
40
static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
41
41
{
42
42
        int op = (encoded_op >> 28) & 7;
43
43
        int cmp = (encoded_op >> 24) & 15;
48
48
        if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
49
49
                oparg = 1 << oparg;
50
50
 
51
 
        if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
 
51
        if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
52
52
                return -EFAULT;
53
53
 
54
54
#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
109
109
        return ret;
110
110
}
111
111
 
112
 
static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval,
113
 
                                                int newval)
 
112
static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
 
113
                                                u32 oldval, u32 newval)
114
114
{
 
115
        int ret = 0;
115
116
 
116
117
#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
117
118
        /* Real i386 machines have no cmpxchg instruction */
119
120
                return -ENOSYS;
120
121
#endif
121
122
 
122
 
        if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
 
123
        if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
123
124
                return -EFAULT;
124
125
 
125
 
        asm volatile("1:\t" LOCK_PREFIX "cmpxchgl %3, %1\n"
 
126
        asm volatile("1:\t" LOCK_PREFIX "cmpxchgl %4, %2\n"
126
127
                     "2:\t.section .fixup, \"ax\"\n"
127
 
                     "3:\tmov     %2, %0\n"
 
128
                     "3:\tmov     %3, %0\n"
128
129
                     "\tjmp     2b\n"
129
130
                     "\t.previous\n"
130
131
                     _ASM_EXTABLE(1b, 3b)
131
 
                     : "=a" (oldval), "+m" (*uaddr)
132
 
                     : "i" (-EFAULT), "r" (newval), "0" (oldval)
 
132
                     : "+r" (ret), "=a" (oldval), "+m" (*uaddr)
 
133
                     : "i" (-EFAULT), "r" (newval), "1" (oldval)
133
134
                     : "memory"
134
135
        );
135
136
 
136
 
        return oldval;
 
137
        *uval = oldval;
 
138
        return ret;
137
139
}
138
140
 
139
141
#endif