Linux v2.6.15-rc6
[pohmelfs.git] / include / asm-cris / arch-v32 / system.h
bloba3d75d581e2f5d20942eeee48df4dde3a3737409
1 #ifndef _ASM_CRIS_ARCH_SYSTEM_H
2 #define _ASM_CRIS_ARCH_SYSTEM_H
4 #include <linux/config.h>
6 /* Read the CPU version register. */
7 static inline unsigned long rdvr(void)
9 unsigned char vr;
11 __asm__ __volatile__ ("move $vr, %0" : "=rm" (vr));
12 return vr;
15 #define cris_machine_name "crisv32"
17 /* Read the user-mode stack pointer. */
18 static inline unsigned long rdusp(void)
20 unsigned long usp;
22 __asm__ __volatile__ ("move $usp, %0" : "=rm" (usp));
23 return usp;
26 /* Read the current stack pointer. */
27 static inline unsigned long rdsp(void)
29 unsigned long sp;
31 __asm__ __volatile__ ("move.d $sp, %0" : "=rm" (sp));
32 return sp;
35 /* Write the user-mode stack pointer. */
36 #define wrusp(usp) __asm__ __volatile__ ("move %0, $usp" : : "rm" (usp))
38 #define nop() __asm__ __volatile__ ("nop");
40 #define xchg(ptr,x) \
41 ((__typeof__(*(ptr)))__xchg((unsigned long) (x),(ptr),sizeof(*(ptr))))
43 #define tas(ptr) (xchg((ptr),1))
45 struct __xchg_dummy { unsigned long a[100]; };
46 #define __xg(x) ((struct __xchg_dummy *)(x))
48 /* Used for interrupt control. */
49 #define local_save_flags(x) \
50 __asm__ __volatile__ ("move $ccs, %0" : "=rm" (x) : : "memory");
52 #define local_irq_restore(x) \
53 __asm__ __volatile__ ("move %0, $ccs" : : "rm" (x) : "memory");
55 #define local_irq_disable() __asm__ __volatile__ ("di" : : : "memory");
56 #define local_irq_enable() __asm__ __volatile__ ("ei" : : : "memory");
58 #define irqs_disabled() \
59 ({ \
60 unsigned long flags; \
62 local_save_flags(flags);\
63 !(flags & (1 << I_CCS_BITNR)); \
66 /* Used for spinlocks, etc. */
67 #define local_irq_save(x) \
68 __asm__ __volatile__ ("move $ccs, %0\n\tdi" : "=rm" (x) : : "memory");
70 #ifdef CONFIG_SMP
71 typedef struct {
72 volatile unsigned int lock __attribute__ ((aligned(4)));
73 #ifdef CONFIG_PREEMPT
74 unsigned int break_lock;
75 #endif
76 } spinlock_t;
77 #endif
79 #endif /* _ASM_CRIS_ARCH_SYSTEM_H */