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
)
67 #if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64)
70 lui k0
, %hi(pgd_current
)
71 addiu k0
, %lo(pgd_current
)
75 LONG_L k1
, %lo(kernelsp
)(k1
)
77 #if defined(CONFIG_MIPS64) && defined(CONFIG_BUILD_ELF64)
81 LONG_L k1
, kernelsp(k1
)
85 .macro set_saved_sp stackp temp temp2
87 mfc0
\temp
, CP0_CONTEXT
90 LONG_S \stackp
, kernelsp(\temp
)
92 #if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64)
95 lui
\temp
2, %hi(kernelsp
)
97 LONG_S \stackp
, %lo(kernelsp
)(\temp
)
99 #if defined(CONFIG_MIPS64) && defined(CONFIG_BUILD_ELF64)
102 LONG_S \stackp
, kernelsp(\temp
)
106 .macro get_saved_sp
/* Uniprocessor variation */
107 lui k1
, %hi(kernelsp
)
108 LONG_L k1
, %lo(kernelsp
)(k1
)
111 .macro set_saved_sp stackp temp temp2
112 LONG_S \stackp
, kernelsp
121 sll k0
, 3 /* extract cu0 bit */
126 /* Called from user mode, new stack. */
129 PTR_SUBU sp
, k1
, PT_SIZE
130 LONG_S k0
, PT_R29(sp
)
135 LONG_S v1
, PT_STATUS(sp
)
139 LONG_S v1
, PT_CAUSE(sp
)
147 LONG_S v1
, PT_EPC(sp
)
148 LONG_S $
25, PT_R25(sp
)
149 LONG_S $
28, PT_R28(sp
)
150 LONG_S $
31, PT_R31(sp
)
151 ori $
28, sp
, _THREAD_MASK
152 xori $
28, _THREAD_MASK
171 LONG_L $
24, PT_LO(sp
)
177 LONG_L $
24, PT_HI(sp
)
178 LONG_L $
10, PT_R10(sp
)
179 LONG_L $
11, PT_R11(sp
)
181 LONG_L $
12, PT_R12(sp
)
182 LONG_L $
13, PT_R13(sp
)
183 LONG_L $
14, PT_R14(sp
)
184 LONG_L $
15, PT_R15(sp
)
185 LONG_L $
24, PT_R24(sp
)
188 .macro RESTORE_STATIC
189 LONG_L $
16, PT_R16(sp
)
190 LONG_L $
17, PT_R17(sp
)
191 LONG_L $
18, PT_R18(sp
)
192 LONG_L $
19, PT_R19(sp
)
193 LONG_L $
20, PT_R20(sp
)
194 LONG_L $
21, PT_R21(sp
)
195 LONG_L $
22, PT_R22(sp
)
196 LONG_L $
23, PT_R23(sp
)
197 LONG_L $
30, PT_R30(sp
)
200 #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
212 LONG_L v0
, PT_STATUS(sp
)
217 LONG_L $
31, PT_R31(sp
)
218 LONG_L $
28, PT_R28(sp
)
219 LONG_L $
25, PT_R25(sp
)
233 .macro RESTORE_SP_AND_RET
236 LONG_L k0
, PT_EPC(sp
)
237 LONG_L sp
, PT_R29(sp
)
255 LONG_L v0
, PT_STATUS(sp
)
260 LONG_L v1
, PT_EPC(sp
)
262 LONG_L $
31, PT_R31(sp
)
263 LONG_L $
28, PT_R28(sp
)
264 LONG_L $
25, PT_R25(sp
)
278 .macro RESTORE_SP_AND_RET
279 LONG_L sp
, PT_R29(sp
)
288 LONG_L sp
, PT_R29(sp
)
299 .macro RESTORE_ALL_AND_RET
308 * Move to kernel mode and disable interrupts.
309 * Set cp0 enable bit as sign that we're running on the kernel stack
313 li t1
, ST0_CU0
| 0x1f
321 * Move to kernel mode and enable interrupts.
322 * Set cp0 enable bit as sign that we're running on the kernel stack
326 li t1
, ST0_CU0
| 0x1f
334 * Just move to kernel mode and leave interrupts as they are.
335 * Set cp0 enable bit as sign that we're running on the kernel stack
339 li t1
, ST0_CU0
| 0x1e
346 #endif /* _ASM_STACKFRAME_H */