1 #ifndef __ASM_SH_FUTEX_IRQ_H
2 #define __ASM_SH_FUTEX_IRQ_H
4 #include <asm/system.h>
6 static inline int atomic_futex_op_xchg_set(int oparg
, int __user
*uaddr
,
12 local_irq_save(flags
);
14 ret
= get_user(*oldval
, uaddr
);
16 ret
= put_user(oparg
, uaddr
);
18 local_irq_restore(flags
);
23 static inline int atomic_futex_op_xchg_add(int oparg
, int __user
*uaddr
,
29 local_irq_save(flags
);
31 ret
= get_user(*oldval
, uaddr
);
33 ret
= put_user(*oldval
+ oparg
, uaddr
);
35 local_irq_restore(flags
);
40 static inline int atomic_futex_op_xchg_or(int oparg
, int __user
*uaddr
,
46 local_irq_save(flags
);
48 ret
= get_user(*oldval
, uaddr
);
50 ret
= put_user(*oldval
| oparg
, uaddr
);
52 local_irq_restore(flags
);
57 static inline int atomic_futex_op_xchg_and(int oparg
, int __user
*uaddr
,
63 local_irq_save(flags
);
65 ret
= get_user(*oldval
, uaddr
);
67 ret
= put_user(*oldval
& oparg
, uaddr
);
69 local_irq_restore(flags
);
74 static inline int atomic_futex_op_xchg_xor(int oparg
, int __user
*uaddr
,
80 local_irq_save(flags
);
82 ret
= get_user(*oldval
, uaddr
);
84 ret
= put_user(*oldval
^ oparg
, uaddr
);
86 local_irq_restore(flags
);
91 static inline int atomic_futex_op_cmpxchg_inatomic(int __user
*uaddr
,
92 int oldval
, int newval
)
97 local_irq_save(flags
);
99 ret
= get_user(prev
, uaddr
);
100 if (!ret
&& oldval
== prev
)
101 ret
= put_user(newval
, uaddr
);
103 local_irq_restore(flags
);
111 #endif /* __ASM_SH_FUTEX_IRQ_H */