2 * include/asm-mips/stackframe.h 4 * Copyright (C) 1994, 1995, 1996 by Ralf Baechle and Paul M. Antoine. 6 * $Id: stackframe.h,v 1.7 1998/04/28 19:39:15 ralf Exp $ 8 #ifndef __ASM_MIPS_STACKFRAME_H 9 #define __ASM_MIPS_STACKFRAME_H 12 #include <asm/offset.h> 44 #define __str(x) __str2(x) 46 #define save_static(frame) \ 47 __asm__ __volatile__( \ 48 "sw\t$16,"__str(PT_R16)"(%0)\n\t" \ 49 "sw\t$17,"__str(PT_R17)"(%0)\n\t" \ 50 "sw\t$18,"__str(PT_R18)"(%0)\n\t" \ 51 "sw\t$19,"__str(PT_R19)"(%0)\n\t" \ 52 "sw\t$20,"__str(PT_R20)"(%0)\n\t" \ 53 "sw\t$21,"__str(PT_R21)"(%0)\n\t" \ 54 "sw\t$22,"__str(PT_R22)"(%0)\n\t" \ 55 "sw\t$23,"__str(PT_R23)"(%0)\n\t" \ 56 "sw\t$30,"__str(PT_R30)"(%0)\n\t" \ 63 mfc0 k0, CP0_STATUS; \ 64 sll k0, 3;/* extract cu0 bit */ \ 69 /* Called from user mode, new stack. */ \ 70 lui k1, %hi(kernelsp); \ 71 lw k1, %lo(kernelsp)(k1); \ 74 subu sp, k1, PT_SIZE; \ 78 mfc0 v1, CP0_STATUS; \ 80 sw v1, PT_STATUS(sp); \ 84 sw v1, PT_CAUSE(sp); \ 92 ori $28, sp, 0x1fff; \ 108 #define RESTORE_TEMP \ 115 lw $11, PT_R11(sp); \ 117 lw $12, PT_R12(sp); \ 118 lw $13, PT_R13(sp); \ 119 lw $14, PT_R14(sp); \ 120 lw $15, PT_R15(sp); \ 123 #define RESTORE_STATIC \ 124 lw $16, PT_R16(sp); \ 125 lw $17, PT_R17(sp); \ 126 lw $18, PT_R18(sp); \ 127 lw $19, PT_R19(sp); \ 128 lw $20, PT_R20(sp); \ 129 lw $21, PT_R21(sp); \ 130 lw $22, PT_R22(sp); \ 131 lw $23, PT_R23(sp); \ 134 #define RESTORE_SOME \ 137 mfc0 t0, CP0_STATUS; \ 141 mtc0 t0, CP0_STATUS; \ 144 lw v0, PT_STATUS(sp); \ 148 mtc0 v0, CP0_STATUS; \ 151 lw $31, PT_R31(sp); \ 152 lw $28, PT_R28(sp); \ 153 lw $25, PT_R25(sp); \ 161 #define RESTORE_ALL \ 169 * Move to kernel mode and disable interrupts. 170 * Set cp0 enable bit as sign that we're running on the kernel stack 173 mfc0 t0,CP0_STATUS; \ 174 li t1,ST0_CU0|0x1f; \ 180 * Move to kernel mode and enable interrupts. 181 * Set cp0 enable bit as sign that we're running on the kernel stack 184 mfc0 t0,CP0_STATUS; \ 185 li t1,ST0_CU0|0x1f; \ 191 * Just move to kernel mode and leave interrupts as they are. 192 * Set cp0 enable bit as sign that we're running on the kernel stack 195 mfc0 t0,CP0_STATUS; \ 196 li t1,ST0_CU0|0x1e; \ 201 #endif/* __ASM_MIPS_STACKFRAME_H */