patch-2.1.101 linux/arch/mips/kernel/r2300_switch.S

Next file: linux/arch/mips/kernel/r4k_fpu.S
Previous file: linux/arch/mips/kernel/r2300_scall.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.100/linux/arch/mips/kernel/r2300_switch.S linux/arch/mips/kernel/r2300_switch.S
@@ -1,10 +1,12 @@
-/* $Id: r2300_switch.S,v 1.1.1.1 1997/06/01 03:16:43 ralf Exp $
+/*
  * r2300_switch.S: R3000/R2000 specific task switching code.
  *
  * Copyright (C) 1994, 1995, 1996 by Ralf Baechle and Andreas Busse
  *
  * Multi-cpu abstraction and macros for easier reading:
  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: r2300_switch.S,v 1.2 1998/05/01 01:34:14 ralf Exp $
  */
 #include <asm/asm.h>
 #include <asm/bootinfo.h>
@@ -25,40 +27,34 @@
 MODE_ALIAS	=	0x00e0			# uncachable, dirty, valid
 
 	.text
-	.set	mips3
+	.set	mips1
+	.set	noreorder
 /*
  * Code necessary to switch tasks on an Linux/MIPS machine.
  * FIXME: We don't need to disable interrupts anymore.
  */
 	.align	5
 	LEAF(r2300_resume)
-	GET_CURRENT(t0)
 	mfc0	t1,CP0_STATUS		# Save status register
-	addu	t0,a1			# Add tss offset
-	sw	t1,THREAD_STATUS(t0)
+	sw	t1,THREAD_STATUS($28)
 	ori	t2,t1,0x1f		# Disable interrupts
 	xori	t2,0x1e
 	mtc0	t2,CP0_STATUS
-	CPU_SAVE_NONSCRATCH(t0)
+	CPU_SAVE_NONSCRATCH($28)
 	sll	t2,t1,2			# Save floating point state
-	bgez	t2,2f
-	 sw	ra,THREAD_REG31(t0)
-	sll	t2,t1,5
 	bgez	t2,1f
-	 swc1	$f0, (THREAD_FPU + 0x00)(t0)
-	FPU_SAVE_16ODD(t0)
+	 sw	ra,THREAD_REG31($28)
+	FPU_SAVE($28, t0)
 1:
-	FPU_SAVE_16EVEN(t0, t1)
-2:
-	addu	a0,a1			# Add tss offset
-	lw	t0,THREAD_PGDIR(a0)	# Switch the root pointer
+	move	$28, a0
+	lw	t0,THREAD_PGDIR($28)	# Switch the root pointer
 	li	t1,TLB_ROOT		# get PFN
 	mtc0	t1,CP0_ENTRYHI
 	mtc0	zero,CP0_INDEX
 	srl	t0,12			# PFN is 12 bits west
 	ori	t0,MODE_ALIAS		# want uncachable, dirty, valid
 	mtc0	t0,CP0_ENTRYLO0
-	lw	a2,THREAD_STATUS(a0)
+	lw	a2,THREAD_STATUS($28)
 	tlbwi
 
 	/* Flush TLB. */
@@ -82,19 +78,13 @@
 	xori	t1,1
 	mtc0	t1,CP0_STATUS
 	sll	t0,a2,2
-	bgez	t0,2f
-	 sll	t0,a2,5
 	bgez	t0,1f
-	 lwc1	$f0, (THREAD_FPU + 0x00)(a0)
-	FPU_RESTORE_16ODD(a0)
+	 lw	ra,THREAD_REG31($28)
+	FPU_RESTORE($28, t0)
 1:
-	FPU_RESTORE_16EVEN(a0, t0)
-2:
-	CPU_RESTORE_NONSCRATCH(a0)
-	lw	t0,THREAD_KSP(a0)		# Restore status register
+	CPU_RESTORE_NONSCRATCH($28)
+	addiu	t0, $28, KERNEL_STACK_SIZE-32
 	sw	t0,kernelsp
 	jr	ra
-	 mtc0	a2,CP0_STATUS
+	 mtc0	a2,CP0_STATUS			# Restore status register
 	END(r2300_resume)
-
-

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov