futex.h (e5451c8f8330e03ad3cfa16048b4daf961af434f) | futex.h (30d6e0a4190d37740e9447e4e4815f06992dd8c3) |
---|---|
1#ifndef _ASM_X86_FUTEX_H 2#define _ASM_X86_FUTEX_H 3 4#ifdef __KERNEL__ 5 6#include <linux/futex.h> 7#include <linux/uaccess.h> 8 --- 27 unchanged lines hidden (view full) --- 36 "\tjmp\t3b\n" \ 37 "\t.previous\n" \ 38 _ASM_EXTABLE(1b, 4b) \ 39 _ASM_EXTABLE(2b, 4b) \ 40 : "=&a" (oldval), "=&r" (ret), \ 41 "+m" (*uaddr), "=&r" (tem) \ 42 : "r" (oparg), "i" (-EFAULT), "1" (0)) 43 | 1#ifndef _ASM_X86_FUTEX_H 2#define _ASM_X86_FUTEX_H 3 4#ifdef __KERNEL__ 5 6#include <linux/futex.h> 7#include <linux/uaccess.h> 8 --- 27 unchanged lines hidden (view full) --- 36 "\tjmp\t3b\n" \ 37 "\t.previous\n" \ 38 _ASM_EXTABLE(1b, 4b) \ 39 _ASM_EXTABLE(2b, 4b) \ 40 : "=&a" (oldval), "=&r" (ret), \ 41 "+m" (*uaddr), "=&r" (tem) \ 42 : "r" (oparg), "i" (-EFAULT), "1" (0)) 43 |
44static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) | 44static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, 45 u32 __user *uaddr) |
45{ | 46{ |
46 int op = (encoded_op >> 28) & 7; 47 int cmp = (encoded_op >> 24) & 15; 48 int oparg = (encoded_op << 8) >> 20; 49 int cmparg = (encoded_op << 20) >> 20; | |
50 int oldval = 0, ret, tem; 51 | 47 int oldval = 0, ret, tem; 48 |
52 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 53 oparg = 1 << oparg; 54 55 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) 56 return -EFAULT; 57 | |
58 pagefault_disable(); 59 60 switch (op) { 61 case FUTEX_OP_SET: 62 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg); 63 break; 64 case FUTEX_OP_ADD: 65 __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval, --- 9 unchanged lines hidden (view full) --- 75 __futex_atomic_op2("xorl %4, %3", ret, oldval, uaddr, oparg); 76 break; 77 default: 78 ret = -ENOSYS; 79 } 80 81 pagefault_enable(); 82 | 49 pagefault_disable(); 50 51 switch (op) { 52 case FUTEX_OP_SET: 53 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg); 54 break; 55 case FUTEX_OP_ADD: 56 __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval, --- 9 unchanged lines hidden (view full) --- 66 __futex_atomic_op2("xorl %4, %3", ret, oldval, uaddr, oparg); 67 break; 68 default: 69 ret = -ENOSYS; 70 } 71 72 pagefault_enable(); 73 |
83 if (!ret) { 84 switch (cmp) { 85 case FUTEX_OP_CMP_EQ: 86 ret = (oldval == cmparg); 87 break; 88 case FUTEX_OP_CMP_NE: 89 ret = (oldval != cmparg); 90 break; 91 case FUTEX_OP_CMP_LT: 92 ret = (oldval < cmparg); 93 break; 94 case FUTEX_OP_CMP_GE: 95 ret = (oldval >= cmparg); 96 break; 97 case FUTEX_OP_CMP_LE: 98 ret = (oldval <= cmparg); 99 break; 100 case FUTEX_OP_CMP_GT: 101 ret = (oldval > cmparg); 102 break; 103 default: 104 ret = -ENOSYS; 105 } 106 } | 74 if (!ret) 75 *oval = oldval; 76 |
107 return ret; 108} 109 110static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, 111 u32 oldval, u32 newval) 112{ 113 return user_atomic_cmpxchg_inatomic(uval, uaddr, oldval, newval); 114} 115 116#endif 117#endif /* _ASM_X86_FUTEX_H */ | 77 return ret; 78} 79 80static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, 81 u32 oldval, u32 newval) 82{ 83 return user_atomic_cmpxchg_inatomic(uval, uaddr, oldval, newval); 84} 85 86#endif 87#endif /* _ASM_X86_FUTEX_H */ |