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, 1995, 1996, 1999 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>
16 #include <asm/offset.h>
17 #include <asm/processor.h>
18 #include <asm/addrspace.h>
23 #define __str(x) __str2(x)
25 #define save_static(frame) \
26 __asm__ __volatile__( \
27 "sd\t$16,"__str(PT_R16)"(%0)\n\t" \
28 "sd\t$17,"__str(PT_R17)"(%0)\n\t" \
29 "sd\t$18,"__str(PT_R18)"(%0)\n\t" \
30 "sd\t$19,"__str(PT_R19)"(%0)\n\t" \
31 "sd\t$20,"__str(PT_R20)"(%0)\n\t" \
32 "sd\t$21,"__str(PT_R21)"(%0)\n\t" \
33 "sd\t$22,"__str(PT_R22)"(%0)\n\t" \
34 "sd\t$23,"__str(PT_R23)"(%0)\n\t" \
35 "sd\t$30,"__str(PT_R30)"(%0)\n\t" \
39 #endif /* !__ASSEMBLY__ */
79 .macro get_saved_sp /* R10000 variation */
85 dsll32 k0, k0, 0 /* Get rid of sign extension */
86 dsrl32 k0, k0, 0 /* Get rid of sign extension */
94 .macro set_saved_sp stackp temp
96 dmtc0 \stackp, CP0_WATCHLO
98 mtc0 \stackp, CP0_WATCHLO
99 dsrl32 \temp, \stackp, 0
100 mtc0 \temp, CP0_WATCHHI
104 .macro declare_saved_sp
105 # empty, stackpointer stored in a register
108 .macro get_saved_sp /* Uniprocessor variation */
109 lui k1, %hi(kernelsp)
110 ld k1, %lo(kernelsp)(k1)
113 .macro set_saved_sp stackp temp
117 .macro declare_saved_sp
118 .comm kernelsp, 8, 8 # current stackpointer
126 sll k0, 3 /* extract cu0 bit */
131 /* Called from user mode, new stack. */
134 dsubu sp, k1, PT_SIZE
191 .macro RESTORE_STATIC
240 * Move to kernel mode and disable interrupts.
241 * Set cp0 enable bit as sign that we're running on the kernel stack
252 * Move to kernel mode and enable interrupts.
253 * Set cp0 enable bit as sign that we're running on the kernel stack
257 li t1, ST0_CU0 | 0x1f
264 * Just move to kernel mode and leave interrupts as they are.
265 * Set cp0 enable bit as sign that we're running on the kernel stack
269 li t1, ST0_CU0 | 0x1e
275 #endif /* __ASSEMBLY__ */
277 #endif /* _ASM_STACKFRAME_H */