2 * Copyright 2007-2009 Analog Devices Inc.
4 * Licensed under the GPL-2 or later.
8 * NOTE! The single-stepping code assumes that all interrupt handlers
9 * start by saving SYSCFG on the stack with their first instruction.
13 * Code to save processor context.
14 * We even save the register which are preserved by a function call
15 * - r4, r5, r6, r7, p3, p4, p5
17 .macro save_context_with_interrupts
20 [--sp] = P0; /*orig_p0*/
21 [--sp] = R0; /*orig_r0*/
23 [--sp] = ( R7:0, P5:0 );
60 [--sp] = r0; /* Skip reserved */
68 [--sp] = r0; /* Skip IPEND as well. */
69 /* Switch to other method of keeping interrupts disabled. */
70 #ifdef CONFIG_DEBUG_HWERR
76 [--sp] = RETI; /*orig_pc*/
77 /* Clear all L registers. */
85 .macro save_context_syscall
88 [--sp] = P0; /*orig_p0*/
89 [--sp] = R0; /*orig_r0*/
90 [--sp] = ( R7:0, P5:0 );
127 [--sp] = r0; /* Skip reserved */
135 [--sp] = r0; /* Skip IPEND as well. */
136 [--sp] = RETI; /*orig_pc*/
137 /* Clear all L registers. */
145 .macro save_context_no_interrupts
147 [--sp] = P0; /* orig_p0 */
148 [--sp] = R0; /* orig_r0 */
149 [--sp] = ( R7:0, P5:0 );
194 [--sp] = r0; /* Skip reserved */
203 #ifdef CONFIG_DEBUG_KERNEL
209 [--sp] = r0; /* Skip IPEND as well. */
211 [--sp] = r0; /*orig_pc*/
212 /* Clear all L registers. */
220 .macro restore_context_no_interrupts
221 sp += 4; /* Skip orig_pc */
222 sp += 4; /* Skip IPEND */
228 RETI = r0; /* Restore RETI indirectly when in exception */
231 sp += 4; /* Skip Reserved */
269 ( R7 : 0, P5 : 0) = [ SP ++ ];
270 sp += 8; /* Skip orig_r0/orig_p0 */
274 .macro restore_context_with_interrupts
275 sp += 4; /* Skip orig_pc */
276 sp += 4; /* Skip IPEND */
286 r0 = [p0 + PDA_IRQFLAGS];
288 p0.h = _bfin_irq_flags;
289 p0.l = _bfin_irq_flags;
294 sp += 4; /* Skip Reserved */
332 ( R7 : 0, P5 : 0) = [ SP ++ ];
333 sp += 8; /* Skip orig_r0/orig_p0 */
339 .macro save_context_cplb
340 [--sp] = (R7:0, P5:0);
358 .macro restore_context_cplb
375 (R7:0, P5:0) = [SP++];