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 */
226 #ifdef CONFIG_DEBUG_KERNEL
232 [--sp] = r0; /* Skip IPEND as well. */
234 [--sp] = r0; /*orig_pc*/
235 /* Clear all L registers. */
243 .macro restore_context_no_interrupts
244 sp += 4; /* Skip orig_pc */
245 sp += 4; /* Skip IPEND */
251 RETI = r0; /* Restore RETI indirectly when in exception */
254 sp += 4; /* Skip Reserved */
292 ( R7 : 0, P5 : 0) = [ SP ++ ];
293 sp += 8; /* Skip orig_r0/orig_p0 */
297 .macro restore_context_with_interrupts
298 sp += 4; /* Skip orig_pc */
299 sp += 4; /* Skip IPEND */
309 r0 = [p0 + PDA_IRQFLAGS];
311 p0.h = _bfin_irq_flags;
312 p0.l = _bfin_irq_flags;
317 sp += 4; /* Skip Reserved */
355 ( R7 : 0, P5 : 0) = [ SP ++ ];
356 sp += 8; /* Skip orig_r0/orig_p0 */
362 .macro save_context_cplb
363 [--sp] = (R7:0, P5:0);
381 .macro restore_context_cplb
398 (R7:0, P5:0) = [SP++];