patch-2.4.19 linux-2.4.19/include/asm-mips64/stackframe.h

Next file: linux-2.4.19/include/asm-mips64/system.h
Previous file: linux-2.4.19/include/asm-mips64/spinlock.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/include/asm-mips64/stackframe.h linux-2.4.19/include/asm-mips64/stackframe.h
@@ -1,5 +1,4 @@
-/* $Id: stackframe.h,v 1.3 1999/12/04 03:59:12 ralf Exp $
- *
+/*
  * 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.
@@ -18,7 +17,7 @@
 #include <asm/processor.h>
 #include <asm/addrspace.h>
 
-#ifdef _LANGUAGE_C
+#ifndef __ASSEMBLY__
 
 #define __str2(x) #x
 #define __str(x) __str2(x)
@@ -37,9 +36,9 @@
 		: /* No outputs */                       \
 		: "r" (frame))
 
-#endif /* _LANGUAGE_C */
+#endif /* !__ASSEMBLY__ */
 
-#ifdef _LANGUAGE_ASSEMBLY
+#ifdef __ASSEMBLY__
 
 		.macro	SAVE_AT
 		.set	push
@@ -76,6 +75,42 @@
 		sd	$30, PT_R30(sp)
 		.endm
 
+#ifdef CONFIG_SMP
+		.macro	get_saved_sp	/* R10000 variation */
+		mfc0	k0, CP0_WATCHLO
+		mfc0	k1, CP0_WATCHHI
+		dsll32	k0, k0, 0	/* Get rid of sign extension */
+		dsrl32	k0, k0, 0	/* Get rid of sign extension */
+		dsll32	k1, k1, 0
+		or	k1, k1, k0
+		li	k0, K0BASE
+		or	k1, k1, k0
+		.endm
+
+		.macro	set_saved_sp	stackp temp
+		mtc0	\stackp, CP0_WATCHLO
+		dsrl32	\temp, \stackp, 0
+		mtc0	\temp, CP0_WATCHHI
+		.endm
+
+		.macro	declare_saved_sp
+		# empty, stackpointer stored in a register
+		.endm
+#else
+		.macro	get_saved_sp	/* Uniprocessor variation */
+		lui	k1, %hi(kernelsp)
+		ld	k1, %lo(kernelsp)(k1)
+		.endm
+
+		.macro	set_saved_sp	stackp temp
+		sd	\stackp, kernelsp
+		.endm
+
+		.macro	declare_saved_sp
+		.comm	kernelsp, 8, 8			# current stackpointer
+		.endm
+#endif
+
 		.macro	SAVE_SOME
 		.set	push
 		.set	reorder
@@ -86,20 +121,7 @@
 		 move	k1, sp
 		.set	reorder
 		/* Called from user mode, new stack. */
-#ifndef CONFIG_SMP
-		lui	k1, %hi(kernelsp)
-		ld	k1, %lo(kernelsp)(k1)
-#else
-		mfc0	k0, CP0_WATCHLO
-		mfc0	k1, CP0_WATCHHI
-		dsll32	k0, k0, 0	/* Get rid of sign extension */
-		dsrl32	k0, k0, 0	/* Get rid of sign extension */
-		dsll32	k1, k1, 0
-		or	k1, k1, k0
-		li	k0, K0BASE
-		or	k1, k1, k0
-		daddiu	k1, k1, KERNEL_STACK_SIZE-32
-#endif
+		get_saved_sp
 8:		move	k0, sp
 		dsubu	sp, k1, PT_SIZE
 		sd	k0, PT_R29(sp)
@@ -242,6 +264,6 @@
 		mtc0	t0, CP0_STATUS
 		.endm
 
-#endif /* _LANGUAGE_ASSEMBLY */
+#endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_STACKFRAME_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)