]> rtime.felk.cvut.cz Git - mcf548x/linux.git/blob - arch/m68k/include/asm/entry_mm.h
Fixes (asm, entry, irq, linker, defconfig)
[mcf548x/linux.git] / arch / m68k / include / asm / entry_mm.h
1 #ifndef __M68K_ENTRY_H
2 #define __M68K_ENTRY_H
3
4 #include <asm/setup.h>
5 #include <asm/page.h>
6 #ifdef __ASSEMBLY__
7 #include <asm/thread_info.h>
8 #endif
9
10 #ifdef CONFIG_COLDFIRE
11 #include <asm/coldfire.h>
12 #include <asm/mcfmmu.h>
13 #endif
14
15 /*
16  * Stack layout in 'ret_from_exception':
17  *
18  *      This allows access to the syscall arguments in registers d1-d5
19  *
20  *       0(sp) - d1
21  *       4(sp) - d2
22  *       8(sp) - d3
23  *       C(sp) - d4
24  *      10(sp) - d5
25  *      14(sp) - a0
26  *      18(sp) - a1
27  *      1C(sp) - a2
28  *      20(sp) - d0
29  *      24(sp) - orig_d0
30  *      28(sp) - stack adjustment
31  *      2C(sp) - sr
32  *      2E(sp) - pc
33  *      32(sp) - format & vector
34  *      36(sp) - MMUSR (Coldfire only)
35  *      3A(sp) - MMUAR (Coldfire only)
36  */
37
38 /*
39  * 97/05/14 Andreas: Register %a2 is now set to the current task throughout
40  *                   the whole kernel.
41  */
42
43 /* the following macro is used when enabling interrupts */
44 #if defined(MACH_ATARI_ONLY)
45         /* block out HSYNC on the atari */
46 #define ALLOWINT        (~0x400)
47 #define MAX_NOINT_IPL   3
48 #else
49         /* portable version */
50 #define ALLOWINT        (~0x700)
51 #define MAX_NOINT_IPL   0
52 #endif /* machine compilation types */
53
54 #ifdef __ASSEMBLY__
55
56 #define curptr a2
57
58 LFLUSH_I_AND_D = 0x00000808
59
60 #define SAVE_ALL_INT save_all_int
61 #define SAVE_ALL_SYS save_all_sys
62 #define RESTORE_ALL restore_all
63 /*
64  * This defines the normal kernel pt-regs layout.
65  *
66  * regs a3-a6 and d6-d7 are preserved by C code
67  * the kernel doesn't mess with usp unless it needs to
68  */
69
70 /*
71  * a -1 in the orig_d0 field signifies
72  * that the stack frame is NOT for syscall
73  */
74 .macro  save_all_int
75 #ifdef CONFIG_COLDFIRE
76         movel   MMUSR,%sp@-
77         movel   MMUAR,%sp@-
78 #endif
79         clrl    %sp@-           | stk_adj
80         pea     -1:w            | orig d0
81         movel   %d0,%sp@-       | d0
82 #ifdef CONFIG_COLDFIRE
83         subal   #(8*4), %sp
84         moveml  %d1-%d5/%a0-%a1/%curptr,%sp@
85 #else
86         moveml  %d1-%d5/%a0-%a1/%curptr,%sp@-
87 #endif
88 .endm
89
90 .macro  save_all_sys
91 #ifdef CONFIG_COLDFIRE
92         movel   MMUSR,%sp@-
93         movel   MMUAR,%sp@-
94 #endif
95         clrl    %sp@-           | stk_adj
96         movel   %d0,%sp@-       | orig d0
97         movel   %d0,%sp@-       | d0
98 #ifdef CONFIG_COLDFIRE
99         subal   #(8*4), %sp
100         moveml  %d1-%d5/%a0-%a1/%curptr,%sp@
101 #else
102         moveml  %d1-%d5/%a0-%a1/%curptr,%sp@-
103 #endif
104 .endm
105
106 .macro  restore_all
107 #ifdef CONFIG_COLDFIRE
108         moveml  %sp@,%a0-%a1/%curptr/%d1-%d5
109         addal   #(8*4), %sp
110 #else
111         moveml  %sp@+,%a0-%a1/%curptr/%d1-%d5
112 #endif
113         movel   %sp@+,%d0
114         addql   #4,%sp          | orig d0
115         addl    %sp@+,%sp       | stk adj
116 #ifdef CONFIG_COLDFIRE
117         addql   #8,%sp          | MMUAR & MMUSR
118 #endif
119         rte
120 .endm
121
122 #define SWITCH_STACK_SIZE (6*4+4)       /* includes return address */
123
124 #define SAVE_SWITCH_STACK save_switch_stack
125 #define RESTORE_SWITCH_STACK restore_switch_stack
126 #define GET_CURRENT(tmp) get_current tmp
127
128 #ifdef CONFIG_COLDFIRE
129
130 .macro  save_switch_stack
131         subal   #(6*4), %sp
132         moveml  %a3-%a6/%d6-%d7,%sp@
133 .endm
134
135 .macro  restore_switch_stack
136         moveml  %sp@,%a3-%a6/%d6-%d7
137         addal   #(6*4), %sp
138 .endm
139
140 .macro  get_current reg=%d0
141         movel   %sp,\reg
142         andl    #-THREAD_SIZE,\reg
143         movel   \reg,%curptr
144         movel   %curptr@,%curptr
145 .endm
146
147 #else
148
149 .macro  save_switch_stack
150         moveml  %a3-%a6/%d6-%d7,%sp@-
151 .endm
152
153 .macro  restore_switch_stack
154         moveml  %sp@+,%a3-%a6/%d6-%d7
155 .endm
156
157 .macro  get_current reg=%d0
158         movel   %sp,\reg
159         andw    #-THREAD_SIZE,\reg
160         movel   \reg,%curptr
161         movel   %curptr@,%curptr
162 .endm
163
164 #endif
165
166
167
168 #else /* C source */
169
170 #define STR(X) STR1(X)
171 #define STR1(X) #X
172
173 #ifdef CONFIG_COLDFIRE
174
175 #define SAVE_ALL_INT                            \
176         "clrl   %%sp@-;"    /* stk_adj */       \
177         "pea    -1:w;"      /* orig d0 = -1 */  \
178         "movel  %%d0,%%sp@-;" /* d0 */          \
179         "subal  #(8*4),%sp"                     \
180         "moveml %%d1-%%d5/%%a0-%%a2,%%sp@"
181 #define GET_CURRENT(tmp) \
182         "movel  %%sp,"#tmp"\n\t" \
183         "andl   #-"STR(THREAD_SIZE)","#tmp"\n\t" \
184         "movel  "#tmp",%%a2\n\t"
185
186 #else
187
188 #define SAVE_ALL_INT                            \
189         "clrl   %%sp@-;"    /* stk_adj */       \
190         "pea    -1:w;"      /* orig d0 = -1 */  \
191         "movel  %%d0,%%sp@-;" /* d0 */          \
192         "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
193 #define GET_CURRENT(tmp) \
194         "movel  %%sp,"#tmp"\n\t" \
195         "andw   #-"STR(THREAD_SIZE)","#tmp"\n\t" \
196         "movel  "#tmp",%%a2\n\t" \
197         "movel  %%a2@,%%a2"
198
199 #endif
200
201 #endif
202
203 #endif /* __M68K_ENTRY_H */