]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - include/asm-blackfin/entry.h
imported Ka-Ro specific additions to U-Boot 2009.08 for TX28
[karo-tx-uboot.git] / include / asm-blackfin / entry.h
1 /*
2  * entry.h - routines for context saving and restoring (for interrupts/exceptions)
3  *
4  * Copyright (c) 2005-2007 Analog Devices Inc.
5  *
6  * See file CREDITS for list of people who contributed to this
7  * project.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22  * MA 02110-1301 USA
23  */
24
25 #ifndef __BLACKFIN_ENTRY_H
26 #define __BLACKFIN_ENTRY_H
27 #ifdef __ASSEMBLY__
28
29 #define SAVE_ALL_INT            save_context_no_interrupts
30 #define SAVE_ALL_SYS            save_context_no_interrupts
31 #define SAVE_CONTEXT            save_context_with_interrupts
32
33 #define RESTORE_ALL             restore_context_no_interrupts
34 #define RESTORE_ALL_SYS         restore_context_no_interrupts
35 #define RESTORE_CONTEXT         restore_context_with_interrupts
36
37 /*
38  * Code to save processor context.
39  * We even save the register which are preserved by a function call
40  * - r4, r5, r6, r7, p3, p4, p5
41  */
42 .macro save_context_with_interrupts
43         [--sp] = R0;
44         [--sp] = ( R7:0, P5:0 );
45         [--sp] = fp;
46         [--sp] = usp;
47
48         [--sp] = i0;
49         [--sp] = i1;
50         [--sp] = i2;
51         [--sp] = i3;
52
53         [--sp] = m0;
54         [--sp] = m1;
55         [--sp] = m2;
56         [--sp] = m3;
57
58         [--sp] = l0;
59         [--sp] = l1;
60         [--sp] = l2;
61         [--sp] = l3;
62
63         [--sp] = b0;
64         [--sp] = b1;
65         [--sp] = b2;
66         [--sp] = b3;
67         [--sp] = a0.x;
68         [--sp] = a0.w;
69         [--sp] = a1.x;
70         [--sp] = a1.w;
71
72         [--sp] = LC0;
73         [--sp] = LC1;
74         [--sp] = LT0;
75         [--sp] = LT1;
76         [--sp] = LB0;
77         [--sp] = LB1;
78
79         [--sp] = ASTAT;
80
81         [--sp] = r0;    /* Skip reserved */
82         [--sp] = RETS;
83         [--sp] = RETI;
84         [--sp] = RETX;
85         [--sp] = RETN;
86         [--sp] = RETE;
87         [--sp] = SEQSTAT;
88         [--sp] = SYSCFG;
89         [--sp] = r0;    /* Skip IPEND as well. */
90 .endm
91
92 .macro save_context_no_interrupts
93         [--sp] = R0;
94         [--sp] = ( R7:0, P5:0 );
95         [--sp] = fp;
96         [--sp] = usp;
97
98         [--sp] = i0;
99         [--sp] = i1;
100         [--sp] = i2;
101         [--sp] = i3;
102
103         [--sp] = m0;
104         [--sp] = m1;
105         [--sp] = m2;
106         [--sp] = m3;
107
108         [--sp] = l0;
109         [--sp] = l1;
110         [--sp] = l2;
111         [--sp] = l3;
112
113         [--sp] = b0;
114         [--sp] = b1;
115         [--sp] = b2;
116         [--sp] = b3;
117         [--sp] = a0.x;
118         [--sp] = a0.w;
119         [--sp] = a1.x;
120         [--sp] = a1.w;
121
122         [--sp] = LC0;
123         [--sp] = LC1;
124         [--sp] = LT0;
125         [--sp] = LT1;
126         [--sp] = LB0;
127         [--sp] = LB1;
128
129         [--sp] = ASTAT;
130
131         [--sp] = r0;    /* Skip reserved */
132         [--sp] = RETS;
133         r0 = RETI;
134         [--sp] = r0;
135         [--sp] = RETX;
136         [--sp] = RETN;
137         [--sp] = RETE;
138         [--sp] = SEQSTAT;
139         [--sp] = SYSCFG;
140         [--sp] = r0;    /* Skip IPEND as well. */
141 .endm
142
143 .macro restore_context_no_interrupts
144         sp += 4;
145         SYSCFG = [sp++];
146         SEQSTAT = [sp++];
147         RETE = [sp++];
148         RETN = [sp++];
149         RETX = [sp++];
150         r0 = [sp++];
151         RETI = r0;
152         RETS = [sp++];
153
154         sp += 4;
155
156         ASTAT = [sp++];
157
158         LB1 = [sp++];
159         LB0 = [sp++];
160         LT1 = [sp++];
161         LT0 = [sp++];
162         LC1 = [sp++];
163         LC0 = [sp++];
164
165         a1.w = [sp++];
166         a1.x = [sp++];
167         a0.w = [sp++];
168         a0.x = [sp++];
169         b3 = [sp++];
170         b2 = [sp++];
171         b1 = [sp++];
172         b0 = [sp++];
173
174         l3 = [sp++];
175         l2 = [sp++];
176         l1 = [sp++];
177         l0 = [sp++];
178
179         m3 = [sp++];
180         m2 = [sp++];
181         m1 = [sp++];
182         m0 = [sp++];
183
184         i3 = [sp++];
185         i2 = [sp++];
186         i1 = [sp++];
187         i0 = [sp++];
188
189         sp += 4;
190         fp = [sp++];
191
192         ( R7 : 0, P5 : 0) = [ SP ++ ];
193         sp += 4;
194 .endm
195
196 .macro restore_context_with_interrupts
197         sp += 4;
198         SYSCFG = [sp++];
199         SEQSTAT = [sp++];
200         RETE = [sp++];
201         RETN = [sp++];
202         RETX = [sp++];
203         RETI = [sp++];
204         RETS = [sp++];
205
206         sp += 4;
207
208         ASTAT = [sp++];
209
210         LB1 = [sp++];
211         LB0 = [sp++];
212         LT1 = [sp++];
213         LT0 = [sp++];
214         LC1 = [sp++];
215         LC0 = [sp++];
216
217         a1.w = [sp++];
218         a1.x = [sp++];
219         a0.w = [sp++];
220         a0.x = [sp++];
221         b3 = [sp++];
222         b2 = [sp++];
223         b1 = [sp++];
224         b0 = [sp++];
225
226         l3 = [sp++];
227         l2 = [sp++];
228         l1 = [sp++];
229         l0 = [sp++];
230
231         m3 = [sp++];
232         m2 = [sp++];
233         m1 = [sp++];
234         m0 = [sp++];
235
236         i3 = [sp++];
237         i2 = [sp++];
238         i1 = [sp++];
239         i0 = [sp++];
240
241         sp += 4;
242         fp = [sp++];
243
244         ( R7 : 0, P5 : 0) = [ SP ++ ];
245         sp += 4;
246 .endm
247
248 #endif
249 #endif