2 * File: arch/blackfin/kernel/context.S
10 * Copyright 2004-2007 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 * NOTE! The single-stepping code assumes that all interrupt handlers
32 * start by saving SYSCFG on the stack with their first instruction.
36 * Code to save processor context.
37 * We even save the register which are preserved by a function call
38 * - r4, r5, r6, r7, p3, p4, p5
40 .macro save_context_with_interrupts
43 [--sp] = P0; /*orig_p0*/
44 [--sp] = R0; /*orig_r0*/
46 [--sp] = ( R7:0, P5:0 );
83 [--sp] = r0; /* Skip reserved */
91 [--sp] = r0; /* Skip IPEND as well. */
92 /* Switch to other method of keeping interrupts disabled. */
93 #ifdef CONFIG_DEBUG_HWERR
99 [--sp] = RETI; /*orig_pc*/
100 /* Clear all L registers. */
108 .macro save_context_syscall
111 [--sp] = P0; /*orig_p0*/
112 [--sp] = R0; /*orig_r0*/
113 [--sp] = ( R7:0, P5:0 );
150 [--sp] = r0; /* Skip reserved */
158 [--sp] = r0; /* Skip IPEND as well. */
159 [--sp] = RETI; /*orig_pc*/
160 /* Clear all L registers. */
168 .macro save_context_no_interrupts
170 [--sp] = P0; /* orig_p0 */
171 [--sp] = R0; /* orig_r0 */
172 [--sp] = ( R7:0, P5:0 );
217 [--sp] = r0; /* Skip reserved */
231 [--sp] = r0; /* Skip IPEND as well. */
233 [--sp] = r0; /*orig_pc*/
234 /* Clear all L registers. */
242 .macro restore_context_no_interrupts
243 sp += 4; /* Skip orig_pc */
244 sp += 4; /* Skip IPEND */
250 RETI = r0; /* Restore RETI indirectly when in exception */
253 sp += 4; /* Skip Reserved */
291 ( R7 : 0, P5 : 0) = [ SP ++ ];
292 sp += 8; /* Skip orig_r0/orig_p0 */
296 .macro restore_context_with_interrupts
297 sp += 4; /* Skip orig_pc */
298 sp += 4; /* Skip IPEND */
308 r0 = [p0 + PDA_IRQFLAGS];
310 p0.h = _bfin_irq_flags;
311 p0.l = _bfin_irq_flags;
316 sp += 4; /* Skip Reserved */
354 ( R7 : 0, P5 : 0) = [ SP ++ ];
355 sp += 8; /* Skip orig_r0/orig_p0 */
361 .macro save_context_cplb
362 [--sp] = (R7:0, P5:0);
380 .macro restore_context_cplb
397 (R7:0, P5:0) = [SP++];