more changes on original files
[linux-2.4.git] / include / asm-arm / proc-armo / assembler.h
1 /*
2  *  linux/asm-arm/proc-armo/assembler.h
3  *
4  *  Copyright (C) 1996 Russell King
5  *
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.
9  *
10  *  This file contains arm architecture specific defines
11  *  for the different processors
12  */
13 #define MODE_USR        USR26_MODE
14 #define MODE_FIQ        FIQ26_MODE
15 #define MODE_IRQ        IRQ26_MODE
16 #define MODE_SVC        SVC26_MODE
17
18 #define DEFAULT_FIQ     MODE_FIQ
19
20 #ifdef __STDC__
21 #define LOADREGS(cond, base, reglist...)\
22         ldm##cond       base,reglist^
23
24 #define RETINSTR(instr, regs...)\
25         instr##s        regs
26 #else
27 #define LOADREGS(cond, base, reglist...)\
28         ldm/**/cond     base,reglist^
29
30 #define RETINSTR(instr, regs...)\
31         instr/**/s      regs
32 #endif
33
34 #define MODENOP\
35         mov     r0, r0
36
37 #define MODE(savereg,tmpreg,mode) \
38         mov     savereg, pc; \
39         bic     tmpreg, savereg, $0x0c000003; \
40         orr     tmpreg, tmpreg, $mode; \
41         teqp    tmpreg, $0
42
43 #define RESTOREMODE(savereg) \
44         teqp    savereg, $0
45
46 #define SAVEIRQS(tmpreg)
47
48 #define RESTOREIRQS(tmpreg)
49
50 #define DISABLEIRQS(tmpreg)\
51         teqp    pc, $0x08000003
52
53 #define ENABLEIRQS(tmpreg)\
54         teqp    pc, $0x00000003
55
56 #define USERMODE(tmpreg)\
57         teqp    pc, $0x00000000;\
58         mov     r0, r0
59
60 #define SVCMODE(tmpreg)\
61         teqp    pc, $0x00000003;\
62         mov     r0, r0
63
64
65 /*
66  * Save the current IRQ state and disable IRQs
67  * Note that this macro assumes FIQs are enabled, and
68  * that the processor is in SVC mode.
69  */
70         .macro  save_and_disable_irqs, oldcpsr, temp
71   mov \oldcpsr, pc
72   orr \temp, \oldcpsr, #0x08000000
73   teqp \temp, #0
74   .endm
75
76 /*
77  * Restore interrupt state previously stored in
78  * a register
79  * ** Actually do nothing on Arc - hope that the caller uses a MOVS PC soon
80  * after!
81  */
82         .macro  restore_irqs, oldcpsr
83   @ This be restore_irqs
84   .endm
85
86 /*
87  * These two are used to save LR/restore PC over a user-based access.
88  * The old 26-bit architecture requires that we do.  On 32-bit
89  * architecture, we can safely ignore this requirement.
90  */
91         .macro  save_lr
92         str     lr, [sp, #-4]!
93         .endm
94
95         .macro  restore_pc
96         ldmfd   sp!, {pc}^
97         .endm
98
99 #define USER(x...)                              \
100 9999:   x;                                      \
101         .section __ex_table,"a";                \
102         .align  3;                              \
103         .long   9999b,9001f;                    \
104         .previous
105
106