Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / score / include / asm / system.h
blob589d5c7e171c26dfefcc2e4a212672727455d673
1 #ifndef _ASM_SCORE_SYSTEM_H
2 #define _ASM_SCORE_SYSTEM_H
4 #include <linux/types.h>
5 #include <linux/irqflags.h>
7 struct pt_regs;
8 struct task_struct;
10 extern void *resume(void *last, void *next, void *next_ti);
12 #define switch_to(prev, next, last) \
13 do { \
14 (last) = resume(prev, next, task_thread_info(next)); \
15 } while (0)
17 #define finish_arch_switch(prev) do {} while (0)
19 typedef void (*vi_handler_t)(void);
20 extern unsigned long arch_align_stack(unsigned long sp);
22 #define mb() barrier()
23 #define rmb() barrier()
24 #define wmb() barrier()
25 #define smp_mb() barrier()
26 #define smp_rmb() barrier()
27 #define smp_wmb() barrier()
29 #define read_barrier_depends() do {} while (0)
30 #define smp_read_barrier_depends() do {} while (0)
32 #define set_mb(var, value) do {var = value; wmb(); } while (0)
34 #define __HAVE_ARCH_CMPXCHG 1
36 #include <asm-generic/cmpxchg-local.h>
38 #ifndef __ASSEMBLY__
40 struct __xchg_dummy { unsigned long a[100]; };
41 #define __xg(x) ((struct __xchg_dummy *)(x))
43 static inline
44 unsigned long __xchg(volatile unsigned long *m, unsigned long val)
46 unsigned long retval;
47 unsigned long flags;
49 local_irq_save(flags);
50 retval = *m;
51 *m = val;
52 local_irq_restore(flags);
53 return retval;
56 #define xchg(ptr, v) \
57 ((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr), \
58 (unsigned long)(v)))
60 static inline unsigned long __cmpxchg(volatile unsigned long *m,
61 unsigned long old, unsigned long new)
63 unsigned long retval;
64 unsigned long flags;
66 local_irq_save(flags);
67 retval = *m;
68 if (retval == old)
69 *m = new;
70 local_irq_restore(flags);
71 return retval;
74 #define cmpxchg(ptr, o, n) \
75 ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \
76 (unsigned long)(o), \
77 (unsigned long)(n)))
79 extern void __die(const char *, struct pt_regs *, const char *,
80 const char *, unsigned long) __attribute__((noreturn));
81 extern void __die_if_kernel(const char *, struct pt_regs *, const char *,
82 const char *, unsigned long);
84 #define die(msg, regs) \
85 __die(msg, regs, __FILE__ ":", __func__, __LINE__)
86 #define die_if_kernel(msg, regs) \
87 __die_if_kernel(msg, regs, __FILE__ ":", __func__, __LINE__)
89 #endif /* !__ASSEMBLY__ */
90 #endif /* _ASM_SCORE_SYSTEM_H */