mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 12:21:37 +00:00
88f182dd77
Apply the asm_volatile_goto() compiler quirk to the new rmwcc.h
file as well, introduced in:
c2daa3bed5
sched, x86: Provide a per-cpu preempt_count implementation
Reported-and-tested-by: Fengguang Wu <fengguang.wu@intel.com>
Reported-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Suggested-by: Jakub Jelinek <jakub@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
42 lines
1.0 KiB
C
42 lines
1.0 KiB
C
#ifndef _ASM_X86_RMWcc
|
|
#define _ASM_X86_RMWcc
|
|
|
|
#ifdef CC_HAVE_ASM_GOTO
|
|
|
|
#define __GEN_RMWcc(fullop, var, cc, ...) \
|
|
do { \
|
|
asm_volatile_goto (fullop "; j" cc " %l[cc_label]" \
|
|
: : "m" (var), ## __VA_ARGS__ \
|
|
: "memory" : cc_label); \
|
|
return 0; \
|
|
cc_label: \
|
|
return 1; \
|
|
} while (0)
|
|
|
|
#define GEN_UNARY_RMWcc(op, var, arg0, cc) \
|
|
__GEN_RMWcc(op " " arg0, var, cc)
|
|
|
|
#define GEN_BINARY_RMWcc(op, var, val, arg0, cc) \
|
|
__GEN_RMWcc(op " %1, " arg0, var, cc, "er" (val))
|
|
|
|
#else /* !CC_HAVE_ASM_GOTO */
|
|
|
|
#define __GEN_RMWcc(fullop, var, cc, ...) \
|
|
do { \
|
|
char c; \
|
|
asm volatile (fullop "; set" cc " %1" \
|
|
: "+m" (var), "=qm" (c) \
|
|
: __VA_ARGS__ : "memory"); \
|
|
return c != 0; \
|
|
} while (0)
|
|
|
|
#define GEN_UNARY_RMWcc(op, var, arg0, cc) \
|
|
__GEN_RMWcc(op " " arg0, var, cc)
|
|
|
|
#define GEN_BINARY_RMWcc(op, var, val, arg0, cc) \
|
|
__GEN_RMWcc(op " %2, " arg0, var, cc, "er" (val))
|
|
|
|
#endif /* CC_HAVE_ASM_GOTO */
|
|
|
|
#endif /* _ASM_X86_RMWcc */
|