2 * linux/include/asm-arm/proc-armo/system.h
4 * Copyright (C) 1995, 1996 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 #ifndef __ASM_PROC_SYSTEM_H
11 #define __ASM_PROC_SYSTEM_H
13 #include <asm/proc-fns.h>
15 #define vectors_base() (0)
17 static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
19 extern void __bad_xchg(volatile void *, int);
22 case 1: return cpu_xchg_1(x, ptr);
23 case 4: return cpu_xchg_4(x, ptr);
24 default: __bad_xchg(ptr, size);
30 * We need to turn the caches off before calling the reset vector - RiscOS
31 * messes up if we don't
33 #define proc_hard_reset() cpu_proc_fin()
36 * A couple of speedups for the ARM
40 * Save the current interrupt enable state & disable IRQs
42 #define local_save_flags_cli(x) \
45 __asm__ __volatile__( \
46 " mov %0, pc @ save_flags_cli\n" \
47 " orr %1, %0, #0x08000000\n" \
48 " and %0, %0, #0x0c000000\n" \
50 : "=r" (x), "=r" (temp) \
58 #define local_irq_enable() \
61 __asm__ __volatile__( \
62 " mov %0, pc @ sti\n" \
63 " bic %0, %0, #0x08000000\n" \
73 #define local_irq_disable() \
76 __asm__ __volatile__( \
77 " mov %0, pc @ cli\n" \
78 " orr %0, %0, #0x08000000\n" \
85 #define __clf() do { \
87 __asm__ __volatile__( \
88 " mov %0, pc @ clf\n" \
89 " orr %0, %0, #0x04000000\n" \
94 #define __stf() do { \
96 __asm__ __volatile__( \
97 " mov %0, pc @ stf\n" \
98 " bic %0, %0, #0x04000000\n" \
104 * save current IRQ & FIQ state
106 #define local_save_flags(x) \
108 __asm__ __volatile__( \
109 " mov %0, pc @ save_flags\n" \
110 " and %0, %0, #0x0c000000\n" \
115 * restore saved IRQ & FIQ state
117 #define local_irq_restore(x) \
119 unsigned long temp; \
120 __asm__ __volatile__( \
121 " mov %0, pc @ restore_flags\n" \
122 " bic %0, %0, #0x0c000000\n" \
123 " orr %0, %0, %1\n" \
130 #define __save_and_sti(x) ({__save_flags(x);__sti();})