2 * U-boot - entry.h Routines for context saving and restoring
4 * Copyright (c) 2005 blackfin.uclinux.org
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #ifndef __BLACKFIN_ENTRY_H
26 #define __BLACKFIN_ENTRY_H
28 #include <linux/config.h>
29 #include <asm/setup.h>
33 * Stack layout in 'ret_from_exception':
38 * Register %p2 is now set to the current task throughout
44 #define LFLUSH_I_AND_D 0x00000808
47 /* process bits for task_struct.flags */
48 #define PF_TRACESYS_OFF 3
49 #define PF_TRACESYS_BIT 5
50 #define PF_PTRACED_OFF 3
51 #define PF_PTRACED_BIT 4
52 #define PF_DTRACE_OFF 1
53 #define PF_DTRACE_BIT 5
57 #if defined(NEW_PT_REGS)
59 #define SAVE_ALL_INT save_context_no_interrupts
60 #define SAVE_ALL_SYS save_context_no_interrupts
61 #define SAVE_CONTEXT save_context_with_interrupts
63 #define RESTORE_ALL restore_context_no_interrupts
64 #define RESTORE_ALL_SYS restore_context_no_interrupts
65 #define RESTORE_CONTEXT restore_context_with_interrupts
69 #define SAVE_ALL_INT save_all_int
70 #define SAVE_ALL_SYS save_all_sys
71 #define SAVE_CONTEXT save_context
72 #define RESTORE_ALL restore_context
73 #define RESTORE_CONTEXT restore_context
78 * Code to save processor context.
79 * We even save the register which are preserved by a function call
80 * - r4, r5, r6, r7, p3, p4, p5
82 .macro save_context_with_interrupts
84 [--sp
] = ( R7
:0, P5
:0 );
121 [--sp
] = r0
; /* Skip reserved */
129 [--sp
] = r0
; /* Skip IPEND as well. */
132 .macro save_context_no_interrupts
134 [--sp
] = ( R7
:0, P5
:0 );
171 [--sp
] = r0
; /* Skip reserved */
180 [--sp
] = r0
; /* Skip IPEND as well. */
183 .macro restore_context_no_interrupts
232 ( R7
: 0, P5
: 0) = [ SP
++ ];
236 .macro restore_context_with_interrupts
284 ( R7
: 0, P5
: 0) = [ SP
++ ];
288 #if !defined(NEW_PT_REGS)
290 * a -1 in the orig_r0 field signifies
291 * that the stack frame is NOT for syscall
294 /* reserved and disable the single step of SYSCFG, by Steven Chen 03/07/10 */
296 r0
.l
= 0x30; /* Errata for BF533 */
298 syscfg
= r0
; /* disable single step flag in SYSCFG */
300 [--sp
] = syscfg
; /* store SYSCFG */
302 [--sp
] = r0
; /* Reserved for IPEND */
316 [--sp
] = retx
; /* current pc when exception happens */
317 [--sp
] = ( r7
:5, p5
:0 );
334 [--sp
] = retx
; /* current pc when exception happens */
335 [--sp
] = ( r7
:5, p5
:0 );
347 ( r7
:5, p5
:0 ) = [sp
++];
356 sp
+= 4; /* orig r0 */
361 sp
+=4; /* Skip the IPEND */
369 #define STR(X) STR1(X)
372 #if defined(NEW_PT_REGS)
374 #define PT_OFF_ORIG_R0 208
379 #define PT_OFF_ORIG_R0 0x54
380 #define PT_OFF_SR 0x38 /* seqstat in pt_regs */