Merge with Linux 2.4.0-test3-pre2.
[linux-2.6/linux-mips.git] / include / asm-arm / proc-armo / system.h
blob36a3515e7a0db0fbbcd7659f2ff51b27fdfc3d66
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 #include <asm/proc-fns.h>
12 extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
14 extern void __bad_xchg(volatile void *, int);
16 switch (size) {
17 case 1: return cpu_xchg_1(x, ptr);
18 case 4: return cpu_xchg_4(x, ptr);
19 default: __bad_xchg(ptr, size);
21 return 0;
25 * We need to turn the caches off before calling the reset vector - RiscOS
26 * messes up if we don't
28 #define proc_hard_reset() cpu_proc_fin()
31 * A couple of speedups for the ARM
35 * Save the current interrupt enable state & disable IRQs
37 #define __save_flags_cli(x) \
38 do { \
39 unsigned long temp; \
40 __asm__ __volatile__( \
41 " mov %0, pc @ save_flags_cli\n" \
42 " orr %1, %0, #0x08000000\n" \
43 " and %0, %0, #0x0c000000\n" \
44 " teqp %1, #0\n" \
45 : "=r" (x), "=r" (temp) \
46 : \
47 : "memory"); \
48 } while (0)
51 * Enable IRQs
53 #define __sti() \
54 do { \
55 unsigned long temp; \
56 __asm__ __volatile__( \
57 " mov %0, pc @ sti\n" \
58 " bic %0, %0, #0x08000000\n" \
59 " teqp %0, #0\n" \
60 : "=r" (temp) \
61 : \
62 : "memory"); \
63 } while(0)
66 * Disable IRQs
68 #define __cli() \
69 do { \
70 unsigned long temp; \
71 __asm__ __volatile__( \
72 " mov %0, pc @ cli\n" \
73 " orr %0, %0, #0x08000000\n" \
74 " teqp %0, #0\n" \
75 : "=r" (temp) \
76 : \
77 : "memory"); \
78 } while(0)
81 * save current IRQ & FIQ state
83 #define __save_flags(x) \
84 do { \
85 __asm__ __volatile__( \
86 " mov %0, pc @ save_flags\n" \
87 " and %0, %0, #0x0c000000\n" \
88 : "=r" (x)); \
89 } while (0)
92 * restore saved IRQ & FIQ state
94 #define __restore_flags(x) \
95 do { \
96 unsigned long temp; \
97 __asm__ __volatile__( \
98 " mov %0, pc @ restore_flags\n" \
99 " bic %0, %0, #0x0c000000\n" \
100 " orr %0, %0, %1\n" \
101 " teqp %0, #0\n" \
102 : "=&r" (temp) \
103 : "r" (x) \
104 : "memory"); \
105 } while (0)
107 #endif