mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-26 19:36:41 +00:00
4eb14db444
Disintegrate asm/system.h for Score. Not compiled. Signed-off-by: David Howells <dhowells@redhat.com> cc: Chen Liqin <liqin.chen@sunplusct.com>
50 lines
1.0 KiB
C
50 lines
1.0 KiB
C
#ifndef _ASM_SCORE_CMPXCHG_H
|
|
#define _ASM_SCORE_CMPXCHG_H
|
|
|
|
#include <linux/irqflags.h>
|
|
|
|
struct __xchg_dummy { unsigned long a[100]; };
|
|
#define __xg(x) ((struct __xchg_dummy *)(x))
|
|
|
|
static inline
|
|
unsigned long __xchg(volatile unsigned long *m, unsigned long val)
|
|
{
|
|
unsigned long retval;
|
|
unsigned long flags;
|
|
|
|
local_irq_save(flags);
|
|
retval = *m;
|
|
*m = val;
|
|
local_irq_restore(flags);
|
|
return retval;
|
|
}
|
|
|
|
#define xchg(ptr, v) \
|
|
((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr), \
|
|
(unsigned long)(v)))
|
|
|
|
static inline unsigned long __cmpxchg(volatile unsigned long *m,
|
|
unsigned long old, unsigned long new)
|
|
{
|
|
unsigned long retval;
|
|
unsigned long flags;
|
|
|
|
local_irq_save(flags);
|
|
retval = *m;
|
|
if (retval == old)
|
|
*m = new;
|
|
local_irq_restore(flags);
|
|
return retval;
|
|
}
|
|
|
|
#define cmpxchg(ptr, o, n) \
|
|
((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \
|
|
(unsigned long)(o), \
|
|
(unsigned long)(n)))
|
|
|
|
#define __HAVE_ARCH_CMPXCHG 1
|
|
|
|
#include <asm-generic/cmpxchg-local.h>
|
|
|
|
#endif /* _ASM_SCORE_CMPXCHG_H */
|