[PATCH] kerneldoc for handle_bad_irq()
[wrt350n-kernel.git] / include / asm-arm26 / assembler.h
blob83f9aec55e4f943190cdf2ccb1d446b966f65247
1 /*
2 * linux/asm/assembler.h
4 * This file contains arm architecture specific defines
5 * for the different processors.
7 * Do not include any C declarations in this file - it is included by
8 * assembler source.
9 */
10 #ifndef __ASSEMBLY__
11 #error "Only include this from assembly code"
12 #endif
15 * Endian independent macros for shifting bytes within registers.
17 #define pull lsr
18 #define push lsl
19 #define byte(x) (x*8)
21 #ifdef __STDC__
22 #define LOADREGS(cond, base, reglist...)\
23 ldm##cond base,reglist^
25 #define RETINSTR(instr, regs...)\
26 instr##s regs
27 #else
28 #define LOADREGS(cond, base, reglist...)\
29 ldm/**/cond base,reglist^
31 #define RETINSTR(instr, regs...)\
32 instr/**/s regs
33 #endif
35 #define MODENOP\
36 mov r0, r0
38 #define MODE(savereg,tmpreg,mode) \
39 mov savereg, pc; \
40 bic tmpreg, savereg, $0x0c000003; \
41 orr tmpreg, tmpreg, $mode; \
42 teqp tmpreg, $0
44 #define RESTOREMODE(savereg) \
45 teqp savereg, $0
47 #define SAVEIRQS(tmpreg)
49 #define RESTOREIRQS(tmpreg)
51 #define DISABLEIRQS(tmpreg)\
52 teqp pc, $0x08000003
54 #define ENABLEIRQS(tmpreg)\
55 teqp pc, $0x00000003
57 #define USERMODE(tmpreg)\
58 teqp pc, $0x00000000;\
59 mov r0, r0
61 #define SVCMODE(tmpreg)\
62 teqp pc, $0x00000003;\
63 mov r0, r0
67 * Save the current IRQ state and disable IRQs
68 * Note that this macro assumes FIQs are enabled, and
69 * that the processor is in SVC mode.
71 .macro save_and_disable_irqs, oldcpsr, temp
72 mov \oldcpsr, pc
73 orr \temp, \oldcpsr, #0x08000000
74 teqp \temp, #0
75 .endm
78 * Restore interrupt state previously stored in
79 * a register
80 * ** Actually do nothing on Arc - hope that the caller uses a MOVS PC soon
81 * after!
83 .macro restore_irqs, oldcpsr
84 @ This be restore_irqs
85 .endm
88 * These two are used to save LR/restore PC over a user-based access.
89 * The old 26-bit architecture requires that we save lr (R14)
91 .macro save_lr
92 str lr, [sp, #-4]!
93 .endm
95 .macro restore_pc
96 ldmfd sp!, {pc}^
97 .endm
99 #define USER(x...) \
100 9999: x; \
101 .section __ex_table,"a"; \
102 .align 3; \
103 .long 9999b,9001f; \
104 .previous