···11+#ifndef __ASM_CRIS_CMPXCHG__22+#define __ASM_CRIS_CMPXCHG__33+44+#include <linux/irqflags.h>55+66+static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)77+{88+ /* since Etrax doesn't have any atomic xchg instructions, we need to disable99+ irq's (if enabled) and do it with move.d's */1010+ unsigned long flags,temp;1111+ local_irq_save(flags); /* save flags, including irq enable bit and shut off irqs */1212+ switch (size) {1313+ case 1:1414+ *((unsigned char *)&temp) = x;1515+ x = *(unsigned char *)ptr;1616+ *(unsigned char *)ptr = *((unsigned char *)&temp);1717+ break;1818+ case 2:1919+ *((unsigned short *)&temp) = x;2020+ x = *(unsigned short *)ptr;2121+ *(unsigned short *)ptr = *((unsigned short *)&temp);2222+ break;2323+ case 4:2424+ temp = x;2525+ x = *(unsigned long *)ptr;2626+ *(unsigned long *)ptr = temp;2727+ break;2828+ }2929+ local_irq_restore(flags); /* restore irq enable bit */3030+ return x;3131+}3232+3333+#define xchg(ptr,x) \3434+ ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))3535+3636+#define tas(ptr) (xchg((ptr),1))3737+3838+#include <asm-generic/cmpxchg-local.h>3939+4040+/*4141+ * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make4242+ * them available.4343+ */4444+#define cmpxchg_local(ptr, o, n) \4545+ ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\4646+ (unsigned long)(n), sizeof(*(ptr))))4747+#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))4848+4949+#ifndef CONFIG_SMP5050+#include <asm-generic/cmpxchg.h>5151+#endif5252+5353+#endif /* __ASM_CRIS_CMPXCHG__ */
···11+#ifndef __ASM_CRIS_SWITCH_TO_H22+#define __ASM_CRIS_SWITCH_TO_H33+44+/* the switch_to macro calls resume, an asm function in entry.S which does the actual55+ * task switching.66+ */77+88+extern struct task_struct *resume(struct task_struct *prev, struct task_struct *next, int);99+#define switch_to(prev,next,last) last = resume(prev,next, \1010+ (int)&((struct task_struct *)0)->thread)1111+1212+#endif /* __ASM_CRIS_SWITCH_TO_H */
+5-89
arch/cris/include/asm/system.h
···11-#ifndef __ASM_CRIS_SYSTEM_H22-#define __ASM_CRIS_SYSTEM_H33-44-#include <linux/irqflags.h>55-#include <arch/system.h>66-77-/* the switch_to macro calls resume, an asm function in entry.S which does the actual88- * task switching.99- */1010-1111-extern struct task_struct *resume(struct task_struct *prev, struct task_struct *next, int);1212-#define switch_to(prev,next,last) last = resume(prev,next, \1313- (int)&((struct task_struct *)0)->thread)1414-1515-#define barrier() __asm__ __volatile__("": : :"memory")1616-#define mb() barrier()1717-#define rmb() mb()1818-#define wmb() mb()1919-#define read_barrier_depends() do { } while(0)2020-#define set_mb(var, value) do { var = value; mb(); } while (0)2121-2222-#ifdef CONFIG_SMP2323-#define smp_mb() mb()2424-#define smp_rmb() rmb()2525-#define smp_wmb() wmb()2626-#define smp_read_barrier_depends() read_barrier_depends()2727-#else2828-#define smp_mb() barrier()2929-#define smp_rmb() barrier()3030-#define smp_wmb() barrier()3131-#define smp_read_barrier_depends() do { } while(0)3232-#endif3333-3434-#define iret()3535-3636-/*3737- * disable hlt during certain critical i/o operations3838- */3939-#define HAVE_DISABLE_HLT4040-void disable_hlt(void);4141-void enable_hlt(void);4242-4343-static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)4444-{4545- /* since Etrax doesn't have any atomic xchg instructions, we need to disable4646- irq's (if enabled) and do it with move.d's */4747- unsigned long flags,temp;4848- local_irq_save(flags); /* save flags, including irq enable bit and shut off irqs */4949- switch (size) {5050- case 1:5151- *((unsigned char *)&temp) = x;5252- x = *(unsigned char *)ptr;5353- *(unsigned char *)ptr = *((unsigned char *)&temp);5454- break;5555- case 2:5656- *((unsigned short *)&temp) = x;5757- x = *(unsigned short *)ptr;5858- *(unsigned short *)ptr = *((unsigned short *)&temp);5959- break;6060- case 4:6161- temp = x;6262- x = *(unsigned long *)ptr;6363- *(unsigned long *)ptr = temp;6464- break;6565- }6666- local_irq_restore(flags); /* restore irq enable bit */6767- return x;6868-}6969-7070-#include <asm-generic/cmpxchg-local.h>7171-7272-/*7373- * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make7474- * them available.7575- */7676-#define cmpxchg_local(ptr, o, n) \7777- ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\7878- (unsigned long)(n), sizeof(*(ptr))))7979-#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))8080-8181-#ifndef CONFIG_SMP8282-#include <asm-generic/cmpxchg.h>8383-#endif8484-8585-#define arch_align_stack(x) (x)8686-8787-void default_idle(void);8888-8989-#endif11+/* FILE TO BE DELETED. DO NOT ADD STUFF HERE! */22+#include <asm/barrier.h>33+#include <asm/cmpxchg.h>44+#include <asm/exec.h>55+#include <asm/switch_to.h>
+1
arch/cris/kernel/irq.c
···3636#include <linux/spinlock.h>37373838#include <asm/io.h>3939+#include <arch/system.h>39404041/* called by the assembler IRQ entry functions defined in irq.h4142 * to dispatch the interrupts to registered handlers
···3737#include <asm/system.h>38383939#include <arch/svinto.h>4040+#include <arch/system.h>40414142/* non-arch dependent serial structures are in linux/serial.h */4243#include <linux/serial.h>