* better
[mascara-docs.git] / i386 / linux-2.3.21 / include / asm-arm / proc-armo / system.h
blob3d6ba7554456df51cffbe954e72860afd0c46918
1 /*
2 * linux/include/asm-arm/proc-armo/system.h
4 * Copyright (C) 1995, 1996 Russell King
5 */
7 #ifndef __ASM_PROC_SYSTEM_H
8 #define __ASM_PROC_SYSTEM_H
10 extern const char xchg_str[];
12 #include <asm/proc-fns.h>
14 extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
16 switch (size) {
17 case 1: return cpu_xchg_1(x, ptr);
18 case 2: return cpu_xchg_2(x, ptr);
19 case 4: return cpu_xchg_4(x, ptr);
20 default: arm_invalidptr(xchg_str, size);
22 return 0;
26 * We need to turn the caches off before calling the reset vector - RiscOS
27 * messes up if we don't
29 #define proc_hard_reset() cpu_proc_fin()
32 * This processor does not idle
34 #define proc_idle()
37 * A couple of speedups for the ARM
41 * Save the current interrupt enable state & disable IRQs
43 #define __save_flags_cli(x) \
44 do { \
45 unsigned long temp; \
46 __asm__ __volatile__( \
47 " mov %0, pc @ save_flags_cli\n" \
48 " orr %1, %0, #0x08000000\n" \
49 " and %0, %0, #0x0c000000\n" \
50 " teqp %1, #0\n" \
51 : "=r" (x), "=r" (temp) \
52 : \
53 : "memory"); \
54 } while (0)
57 * Enable IRQs
59 #define __sti() \
60 do { \
61 unsigned long temp; \
62 __asm__ __volatile__( \
63 " mov %0, pc @ sti\n" \
64 " bic %0, %0, #0x08000000\n" \
65 " teqp %0, #0\n" \
66 : "=r" (temp) \
67 : \
68 : "memory"); \
69 } while(0)
72 * Disable IRQs
74 #define __cli() \
75 do { \
76 unsigned long temp; \
77 __asm__ __volatile__( \
78 " mov %0, pc @ cli\n" \
79 " orr %0, %0, #0x08000000\n" \
80 " teqp %0, #0\n" \
81 : "=r" (temp) \
82 : \
83 : "memory"); \
84 } while(0)
87 * save current IRQ & FIQ state
89 #define __save_flags(x) \
90 do { \
91 __asm__ __volatile__( \
92 " mov %0, pc @ save_flags\n" \
93 " and %0, %0, #0x0c000000\n" \
94 : "=r" (x)); \
95 } while (0)
98 * restore saved IRQ & FIQ state
100 #define __restore_flags(x) \
101 do { \
102 unsigned long temp; \
103 __asm__ __volatile__( \
104 " mov %0, pc @ restore_flags\n" \
105 " bic %0, %0, #0x0c000000\n" \
106 " orr %0, %0, %1\n" \
107 " teqp %0, #0\n" \
108 : "=&r" (temp) \
109 : "r" (x) \
110 : "memory"); \
111 } while (0)
113 /* For spinlocks etc */
114 #define local_irq_save(x) __save_flags_cli(x)
115 #define local_irq_restore(x) __restore_flags(x)
116 #define local_irq_disable() __cli()
117 #define local_irq_enable() __sti()
119 #ifdef __SMP__
120 #error SMP not supported
121 #else
123 #define cli() __cli()
124 #define sti() __sti()
125 #define save_flags(x) __save_flags(x)
126 #define restore_flags(x) __restore_flags(x)
127 #define save_flags_cli(x) __save_flags_cli(x)
129 #endif
131 #endif