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/asm-offsets.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 */
64 LONG_L k1
, %lo(kernelsp
)(k1
)
66 #if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
69 lui k0
, %hi(pgd_current
)
70 addiu k0
, %lo(pgd_current
)
74 LONG_L k1
, %lo(kernelsp
)(k1
)
76 #if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
78 lui k0
, %highest(kernelsp
)
80 daddiu k0
, %higher(kernelsp
)
82 daddiu k0
, %hi(kernelsp
)
85 LONG_L k1
, %lo(kernelsp
)(k1
)
89 .macro set_saved_sp stackp temp temp2
91 mfc0
\temp
, CP0_CONTEXT
93 LONG_S \stackp
, kernelsp(\temp
)
95 #if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
98 lui
\temp
2, %hi(kernelsp
)
100 LONG_S \stackp
, %lo(kernelsp
)(\temp
)
102 #if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
103 MFC0
\temp
, CP0_CONTEXT
105 LONG_S \stackp
, kernelsp(\temp
)
109 .macro get_saved_sp
/* Uniprocessor variation */
110 lui k1
, %hi(kernelsp
)
111 LONG_L k1
, %lo(kernelsp
)(k1
)
114 .macro set_saved_sp stackp temp temp2
115 LONG_S \stackp
, kernelsp
124 sll k0
, 3 /* extract cu0 bit */
129 /* Called from user mode, new stack. */
132 PTR_SUBU sp
, k1
, PT_SIZE
133 LONG_S k0
, PT_R29(sp
)
138 LONG_S v1
, PT_STATUS(sp
)
142 LONG_S v1
, PT_CAUSE(sp
)
150 LONG_S v1
, PT_EPC(sp
)
151 LONG_S $
25, PT_R25(sp
)
152 LONG_S $
28, PT_R28(sp
)
153 LONG_S $
31, PT_R31(sp
)
154 ori $
28, sp
, _THREAD_MASK
155 xori $
28, _THREAD_MASK
174 LONG_L $
24, PT_LO(sp
)
180 LONG_L $
24, PT_HI(sp
)
181 LONG_L $
10, PT_R10(sp
)
182 LONG_L $
11, PT_R11(sp
)
184 LONG_L $
12, PT_R12(sp
)
185 LONG_L $
13, PT_R13(sp
)
186 LONG_L $
14, PT_R14(sp
)
187 LONG_L $
15, PT_R15(sp
)
188 LONG_L $
24, PT_R24(sp
)
191 .macro RESTORE_STATIC
192 LONG_L $
16, PT_R16(sp
)
193 LONG_L $
17, PT_R17(sp
)
194 LONG_L $
18, PT_R18(sp
)
195 LONG_L $
19, PT_R19(sp
)
196 LONG_L $
20, PT_R20(sp
)
197 LONG_L $
21, PT_R21(sp
)
198 LONG_L $
22, PT_R22(sp
)
199 LONG_L $
23, PT_R23(sp
)
200 LONG_L $
30, PT_R30(sp
)
203 #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
215 LONG_L v0
, PT_STATUS(sp
)
220 LONG_L $
31, PT_R31(sp
)
221 LONG_L $
28, PT_R28(sp
)
222 LONG_L $
25, PT_R25(sp
)
236 .macro RESTORE_SP_AND_RET
239 LONG_L k0
, PT_EPC(sp
)
240 LONG_L sp
, PT_R29(sp
)
258 LONG_L v0
, PT_STATUS(sp
)
263 LONG_L v1
, PT_EPC(sp
)
265 LONG_L $
31, PT_R31(sp
)
266 LONG_L $
28, PT_R28(sp
)
267 LONG_L $
25, PT_R25(sp
)
281 .macro RESTORE_SP_AND_RET
282 LONG_L sp
, PT_R29(sp
)
291 LONG_L sp
, PT_R29(sp
)
302 .macro RESTORE_ALL_AND_RET
311 * Move to kernel mode and disable interrupts.
312 * Set cp0 enable bit as sign that we're running on the kernel stack
316 li t1
, ST0_CU0
| 0x1f
324 * Move to kernel mode and enable interrupts.
325 * Set cp0 enable bit as sign that we're running on the kernel stack
329 li t1
, ST0_CU0
| 0x1f
337 * Just move to kernel mode and leave interrupts as they are.
338 * Set cp0 enable bit as sign that we're running on the kernel stack
342 li t1
, ST0_CU0
| 0x1e
349 #endif /* _ASM_STACKFRAME_H */