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 #ifdef CONFIG_TRACE_IRQFLAGS
78 call _trace_hardirqs_off;
81 [--sp] = RETI; /*orig_pc*/
82 /* Clear all L registers. */
90 .macro save_context_syscall
93 [--sp] = P0; /*orig_p0*/
94 [--sp] = R0; /*orig_r0*/
95 [--sp] = ( R7:0, P5:0 );
132 [--sp] = r0; /* Skip reserved */
140 [--sp] = r0; /* Skip IPEND as well. */
141 [--sp] = RETI; /*orig_pc*/
142 /* Clear all L registers. */
150 .macro save_context_no_interrupts
152 [--sp] = P0; /* orig_p0 */
153 [--sp] = R0; /* orig_r0 */
154 [--sp] = ( R7:0, P5:0 );
199 [--sp] = r0; /* Skip reserved */
208 #ifdef CONFIG_DEBUG_KERNEL
214 [--sp] = r0; /* Skip IPEND as well. */
216 [--sp] = r0; /*orig_pc*/
217 /* Clear all L registers. */
225 .macro restore_context_no_interrupts
226 sp += 4; /* Skip orig_pc */
227 sp += 4; /* Skip IPEND */
233 RETI = r0; /* Restore RETI indirectly when in exception */
236 sp += 4; /* Skip Reserved */
274 ( R7 : 0, P5 : 0) = [ SP ++ ];
275 sp += 8; /* Skip orig_r0/orig_p0 */
279 .macro restore_context_with_interrupts
280 sp += 4; /* Skip orig_pc */
281 sp += 4; /* Skip IPEND */
288 #ifdef CONFIG_TRACE_IRQFLAGS
290 call _trace_hardirqs_on;
298 r0 = [p0 + PDA_IRQFLAGS];
300 p0.h = _bfin_irq_flags;
301 p0.l = _bfin_irq_flags;
306 sp += 4; /* Skip Reserved */
344 ( R7 : 0, P5 : 0) = [ SP ++ ];
345 sp += 8; /* Skip orig_r0/orig_p0 */
351 .macro save_context_cplb
352 [--sp] = (R7:0, P5:0);
370 .macro restore_context_cplb
387 (R7:0, P5:0) = [SP++];
390 .macro pseudo_long_call func:req, scratch:req
391 #ifdef CONFIG_ROMKERNEL
392 \scratch\().l = \func;
393 \scratch\().h = \func;