2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1994, 95, 96, 99, 2001 Ralf Baechle
7 * Copyright (C) 1994, 1995, 1996 Paul M. Antoine.
8 * Copyright (C) 1999 Silicon Graphics, Inc.
10 #ifndef _ASM_STACKFRAME_H
11 #define _ASM_STACKFRAME_H
13 #include <linux/config.h>
14 #include <linux/threads.h>
17 #include <asm/mipsregs.h>
18 #include <asm/offset.h>
35 LONG_S $
10, PT_R10(sp
)
36 LONG_S $
11, PT_R11(sp
)
38 LONG_S $
12, PT_R12(sp
)
39 LONG_S $
13, PT_R13(sp
)
40 LONG_S $
14, PT_R14(sp
)
41 LONG_S $
15, PT_R15(sp
)
42 LONG_S $
24, PT_R24(sp
)
46 LONG_S $
16, PT_R16(sp
)
47 LONG_S $
17, PT_R17(sp
)
48 LONG_S $
18, PT_R18(sp
)
49 LONG_S $
19, PT_R19(sp
)
50 LONG_S $
20, PT_R20(sp
)
51 LONG_S $
21, PT_R21(sp
)
52 LONG_S $
22, PT_R22(sp
)
53 LONG_S $
23, PT_R23(sp
)
54 LONG_S $
30, PT_R30(sp
)
58 .macro get_saved_sp
/* SMP variation */
65 LONG_L k1
, %lo(kernelsp
)(k1
)
70 lui k0
, %hi(pgd_current
)
71 daddiu k0
, %lo(pgd_current
)
75 LONG_L k1
, %lo(kernelsp
)(k1
)
79 .macro set_saved_sp stackp temp temp2
81 mfc0
\temp
, CP0_CONTEXT
84 LONG_S \stackp
, kernelsp(\temp
)
89 lui
\temp
2, %hi(kernelsp
)
91 LONG_S \stackp
, %lo(kernelsp
)(\temp
)
95 .macro get_saved_sp
/* Uniprocessor variation */
97 LONG_L k1
, %lo(kernelsp
)(k1
)
100 .macro set_saved_sp stackp temp temp2
101 LONG_S \stackp
, kernelsp
109 sll k0
, 3 /* extract cu0 bit */
114 /* Called from user mode, new stack. */
117 PTR_SUBU sp
, k1
, PT_SIZE
118 LONG_S k0
, PT_R29(sp
)
123 LONG_S v1
, PT_STATUS(sp
)
127 LONG_S v1
, PT_CAUSE(sp
)
135 LONG_S v1
, PT_EPC(sp
)
136 LONG_S $
25, PT_R25(sp
)
137 LONG_S $
28, PT_R28(sp
)
138 LONG_S $
31, PT_R31(sp
)
139 ori $
28, sp
, _THREAD_MASK
140 xori $
28, _THREAD_MASK
159 LONG_L $
24, PT_LO(sp
)
165 LONG_L $
24, PT_HI(sp
)
166 LONG_L $
10, PT_R10(sp
)
167 LONG_L $
11, PT_R11(sp
)
169 LONG_L $
12, PT_R12(sp
)
170 LONG_L $
13, PT_R13(sp
)
171 LONG_L $
14, PT_R14(sp
)
172 LONG_L $
15, PT_R15(sp
)
173 LONG_L $
24, PT_R24(sp
)
176 .macro RESTORE_STATIC
177 LONG_L $
16, PT_R16(sp
)
178 LONG_L $
17, PT_R17(sp
)
179 LONG_L $
18, PT_R18(sp
)
180 LONG_L $
19, PT_R19(sp
)
181 LONG_L $
20, PT_R20(sp
)
182 LONG_L $
21, PT_R21(sp
)
183 LONG_L $
22, PT_R22(sp
)
184 LONG_L $
23, PT_R23(sp
)
185 LONG_L $
30, PT_R30(sp
)
188 #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
200 LONG_L v0
, PT_STATUS(sp
)
205 LONG_L $
31, PT_R31(sp
)
206 LONG_L $
28, PT_R28(sp
)
207 LONG_L $
25, PT_R25(sp
)
221 .macro RESTORE_SP_AND_RET
224 LONG_L k0
, PT_EPC(sp
)
225 LONG_L sp
, PT_R29(sp
)
243 LONG_L v0
, PT_STATUS(sp
)
248 LONG_L v1
, PT_EPC(sp
)
250 LONG_L $
31, PT_R31(sp
)
251 LONG_L $
28, PT_R28(sp
)
252 LONG_L $
25, PT_R25(sp
)
266 .macro RESTORE_SP_AND_RET
267 LONG_L sp
, PT_R29(sp
)
276 LONG_L sp
, PT_R29(sp
)
287 .macro RESTORE_ALL_AND_RET
296 * Move to kernel mode and disable interrupts.
297 * Set cp0 enable bit as sign that we're running on the kernel stack
301 li t1
, ST0_CU0
| 0x1f
309 * Move to kernel mode and enable interrupts.
310 * Set cp0 enable bit as sign that we're running on the kernel stack
314 li t1
, ST0_CU0
| 0x1f
322 * Just move to kernel mode and leave interrupts as they are.
323 * Set cp0 enable bit as sign that we're running on the kernel stack
327 li t1
, ST0_CU0
| 0x1e
334 #endif /* _ASM_STACKFRAME_H */