summaryrefslogtreecommitdiff
path: root/include/asm-mips/stackframe.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 19:08:33 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 19:08:33 -0800
commit2d80cb2a5e022225b9512ccc98f7979cc4b92ce8 (patch)
treea7f247ba424b5366ce443b3d9cb5b4c7f6538e3f /include/asm-mips/stackframe.h
parent75b566af5cc6f64f9ab5b66608ff8ce18098a2b4 (diff)
v2.4.5.8 -> v2.4.5.9
- make sure "sync()" doesn't effectively lock up the machine by overloading all the IO resources - fix up some network memory allocations that don't wan tto wait on IO. - merge with Alan (including MIPS update) - Jeff Garzik: network driver updates. - Al Viro: System V FS update (write capability, page cache, mondo cleanups) - Kai Germaschewski: ISDN cleanups, TURBOPAM driver by Stelian Pop - Ben Fennema: UDF update (time handling, i_blocks fix) - Neil Brown: md error handling improvements, knfsd file handle compatibility - Paul Mackerras: PPC update - Jakub Jelinek: fix up kernel linker scripts to accept .rodata better - Patrick Mochel: fix PME handling in pci_enable_wake() - Chris Mason: reiserfs PF_MEMALLOC handling
Diffstat (limited to 'include/asm-mips/stackframe.h')
-rw-r--r--include/asm-mips/stackframe.h85
1 files changed, 62 insertions, 23 deletions
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 490724b21a66..d46cecef9afc 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -1,13 +1,17 @@
/*
- * include/asm-mips/stackframe.h
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
*
- * Copyright (C) 1994, 1995, 1996 by Ralf Baechle and Paul M. Antoine.
- *
- * $Id: stackframe.h,v 1.10 1999/08/13 17:07:27 harald Exp $
+ * Copyright (C) 1994, 1995, 1996, 2001 Ralf Baechle
+ * Copyright (C) 1994, 1995, 1996 Paul M. Antoine.
*/
-#ifndef __ASM_MIPS_STACKFRAME_H
-#define __ASM_MIPS_STACKFRAME_H
+#ifndef __ASM_STACKFRAME_H
+#define __ASM_STACKFRAME_H
+#include <asm/addrspace.h>
+#include <asm/mipsregs.h>
+#include <asm/processor.h>
#include <asm/asm.h>
#include <asm/offset.h>
#include <linux/config.h>
@@ -47,20 +51,45 @@
#define __str2(x) #x
#define __str(x) __str2(x)
-#define save_static(frame) \
- __asm__ __volatile__( \
- "sw\t$16,"__str(PT_R16)"(%0)\n\t" \
- "sw\t$17,"__str(PT_R17)"(%0)\n\t" \
- "sw\t$18,"__str(PT_R18)"(%0)\n\t" \
- "sw\t$19,"__str(PT_R19)"(%0)\n\t" \
- "sw\t$20,"__str(PT_R20)"(%0)\n\t" \
- "sw\t$21,"__str(PT_R21)"(%0)\n\t" \
- "sw\t$22,"__str(PT_R22)"(%0)\n\t" \
- "sw\t$23,"__str(PT_R23)"(%0)\n\t" \
- "sw\t$30,"__str(PT_R30)"(%0)\n\t" \
- : /* No outputs */ \
- : "r" (frame))
+#define save_static_function(symbol) \
+__asm__ ( \
+ ".globl\t" #symbol "\n\t" \
+ ".align\t2\n\t" \
+ ".type\t" #symbol ", @function\n\t" \
+ ".ent\t" #symbol ", 0\n" \
+ #symbol":\n\t" \
+ ".frame\t$29, 0, $31\n\t" \
+ "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
+ "sw\t$17,"__str(PT_R17)"($29)\n\t" \
+ "sw\t$18,"__str(PT_R18)"($29)\n\t" \
+ "sw\t$19,"__str(PT_R19)"($29)\n\t" \
+ "sw\t$20,"__str(PT_R20)"($29)\n\t" \
+ "sw\t$21,"__str(PT_R21)"($29)\n\t" \
+ "sw\t$22,"__str(PT_R22)"($29)\n\t" \
+ "sw\t$23,"__str(PT_R23)"($29)\n\t" \
+ "sw\t$30,"__str(PT_R30)"($29)\n\t" \
+ ".end\t" #symbol "\n\t" \
+ ".size\t" #symbol",. - " #symbol)
+
+/* Used in declaration of save_static functions. */
+#define static_unused static __attribute__((unused))
+
+
+#ifdef CONFIG_SMP
+# define GET_SAVED_SP \
+ mfc0 k0, CP0_CONTEXT; \
+ lui k1, %hi(kernelsp); \
+ srl k0, k0, 23; \
+ sll k0, k0, 2; \
+ addu k1, k0; \
+ lw k1, %lo(kernelsp)(k1);
+#else
+# define GET_SAVED_SP \
+ lui k1, %hi(kernelsp); \
+ lw k1, %lo(kernelsp)(k1);
+#endif
+
#define SAVE_SOME \
.set push; \
.set reorder; \
@@ -71,13 +100,12 @@
move k1, sp; \
.set reorder; \
/* Called from user mode, new stack. */ \
- lui k1, %hi(kernelsp); \
- lw k1, %lo(kernelsp)(k1); \
+ GET_SAVED_SP \
8: \
move k0, sp; \
subu sp, k1, PT_SIZE; \
sw k0, PT_R29(sp); \
- sw $3, PT_R3(sp); \
+ sw $3, PT_R3(sp); \
sw $0, PT_R0(sp); \
mfc0 v1, CP0_STATUS; \
sw $2, PT_R2(sp); \
@@ -208,6 +236,16 @@
#endif
+#define RESTORE_SP \
+ lw sp, PT_R29(sp); \
+
+#define RESTORE_ALL \
+ RESTORE_SOME; \
+ RESTORE_AT; \
+ RESTORE_TEMP; \
+ RESTORE_STATIC; \
+ RESTORE_SP
+
#define RESTORE_ALL_AND_RET \
RESTORE_SOME; \
RESTORE_AT; \
@@ -215,6 +253,7 @@
RESTORE_STATIC; \
RESTORE_SP_AND_RET
+
/*
* Move to kernel mode and disable interrupts.
* Set cp0 enable bit as sign that we're running on the kernel stack
@@ -248,4 +287,4 @@
xori t0,0x1e; \
mtc0 t0,CP0_STATUS
-#endif /* __ASM_MIPS_STACKFRAME_H */
+#endif /* __ASM_STACKFRAME_H */