patch-1.3.93 linux/arch/sparc/kernel/switch.S
Next file: linux/arch/sparc/kernel/sys_bsd.c
Previous file: linux/arch/sparc/kernel/sunos_ioctl.c
Back to the patch index
Back to the overall index
- Lines: 65
- Date:
Sun Apr 21 12:30:31 1996
- Orig file:
v1.3.92/linux/arch/sparc/kernel/switch.S
- Orig date:
Mon Mar 4 08:49:56 1996
diff -u --recursive --new-file v1.3.92/linux/arch/sparc/kernel/switch.S linux/arch/sparc/kernel/switch.S
@@ -1,4 +1,4 @@
-/* $Id: switch.S,v 1.14 1995/12/29 21:47:22 davem Exp $
+/* $Id: switch.S,v 1.18 1996/04/03 02:15:00 davem Exp $
* switch.S: Sparc task switch code.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -9,6 +9,7 @@
#include <asm/contregs.h>
#include <asm/cprefix.h>
#include <asm/psr.h>
+#include <asm/asmmacro.h>
#include <asm/ptrace.h>
#include <asm/winmacro.h>
@@ -40,8 +41,14 @@
/* Load new kernel state. */
wr %sw_psr, PSR_ET, %psr
WRITE_PAUSE
+#ifdef __SMP__
+ GET_PROCESSOR_OFFSET(sw_psr)
+ set C_LABEL(current_set), %sw_tmp
+ st %sw_ntask, [%sw_tmp + %sw_psr]
+#else
sethi %hi(C_LABEL(current_set)), %sw_tmp
st %sw_ntask, [%sw_tmp + %lo(C_LABEL(current_set))]
+#endif
ldd [%sw_ntask + THREAD_KPSR], %sw_psr
wr %sw_psr, PSR_ET, %psr
WRITE_PAUSE
@@ -55,3 +62,35 @@
retl
nop
+
+
+#ifdef __SMP__
+ /* Because of nasty register windows this is the only way
+ * to start a processor into it's cpu_idle() thread.
+ */
+
+ .globl C_LABEL(sparc_cpusched)
+C_LABEL(sparc_cpusched):
+ LOAD_CURRENT(g1, g2)
+ rd %psr, %g7
+
+ wr %g7, PSR_ET, %psr
+ WRITE_PAUSE
+
+ ldd [%g1 + THREAD_KPSR], %g2
+
+ wr %g2, PSR_ET, %psr
+ WRITE_PAUSE
+
+ wr %g3, 0x0, %wim
+ WRITE_PAUSE
+
+ ldd [%g1 + THREAD_KSP], %sp
+ LOAD_WINDOW(sp)
+
+ wr %g2, 0x0, %psr
+ WRITE_PAUSE
+
+ retl
+ nop
+#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this