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 * Code to save processor context.
32 * We even save the register which are preserved by a function call
33 * - r4, r5, r6, r7, p3, p4, p5
35 .macro save_context_with_interrupts
38 [--sp] = P0; /*orig_p0*/
39 [--sp] = R0; /*orig_r0*/
41 [--sp] = ( R7:0, P5:0 );
78 [--sp] = r0; /* Skip reserved */
86 [--sp] = r0; /* Skip IPEND as well. */
87 /* Switch to other method of keeping interrupts disabled. */
88 #ifdef CONFIG_DEBUG_HWERR
94 [--sp] = RETI; /*orig_pc*/
95 /* Clear all L registers. */
103 .macro save_context_syscall
106 [--sp] = P0; /*orig_p0*/
107 [--sp] = R0; /*orig_r0*/
108 [--sp] = ( R7:0, P5:0 );
145 [--sp] = r0; /* Skip reserved */
153 [--sp] = r0; /* Skip IPEND as well. */
154 [--sp] = RETI; /*orig_pc*/
155 /* Clear all L registers. */
163 .macro save_context_no_interrupts
165 [--sp] = P0; /* orig_p0 */
166 [--sp] = R0; /* orig_r0 */
167 [--sp] = ( R7:0, P5:0 );
212 [--sp] = r0; /* Skip reserved */
226 [--sp] = r0; /* Skip IPEND as well. */
228 [--sp] = r0; /*orig_pc*/
229 /* Clear all L registers. */
237 .macro restore_context_no_interrupts
238 sp += 4; /* Skip orig_pc */
239 sp += 4; /* Skip IPEND */
245 RETI = r0; /* Restore RETI indirectly when in exception */
248 sp += 4; /* Skip Reserved */
286 ( R7 : 0, P5 : 0) = [ SP ++ ];
287 sp += 8; /* Skip orig_r0/orig_p0 */
291 .macro restore_context_with_interrupts
292 sp += 4; /* Skip orig_pc */
293 sp += 4; /* Skip IPEND */
306 sp += 4; /* Skip Reserved */
344 ( R7 : 0, P5 : 0) = [ SP ++ ];
345 sp += 8; /* Skip orig_r0/orig_p0 */