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
, u32 __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
, u32 __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
, u32 __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
, u32 __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
, u32 __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(u32
*uval
,
93 u32 oldval
, u32 newval
)
99 local_irq_save(flags
);
101 ret
= get_user(prev
, uaddr
);
102 if (!ret
&& oldval
== prev
)
103 ret
= put_user(newval
, uaddr
);
105 local_irq_restore(flags
);
111 #endif /* __ASM_SH_FUTEX_IRQ_H */