root/arch/sparc/kernel/switch.S

/* [previous][next][first][last][top][bottom][index][help] */
   1 /* $Id: switch.S,v 1.14 1995/12/29 21:47:22 davem Exp $
   2  * switch.S: Sparc task switch code.
   3  *
   4  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   5  */
   6 
   7 #include <asm/head.h>
   8 #include <asm/asi.h>
   9 #include <asm/contregs.h>
  10 #include <asm/cprefix.h>
  11 #include <asm/psr.h>
  12 #include <asm/ptrace.h>
  13 #include <asm/winmacro.h>
  14 
  15 #define sw_ntask     g1
  16 #define sw_psr       g4
  17 #define sw_wim       g5
  18 #define sw_tmp       g6
  19 #define sw_ctx       g7
  20 
  21 /* Context switch code.  The new process's task_struct
  22  * ptr is passed as the first parameter.
  23  *
  24  * First successful task switch 05/13/95 21:52:37
  25  */
  26         .align 4
  27         .globl  C_LABEL(sparc_switch_to)
  28 C_LABEL(sparc_switch_to):
  29         mov     %o0, %sw_ntask
  30 
  31         /* Save kernel state. */
  32         FLUSH_ALL_KERNEL_WINDOWS; 
  33         STORE_WINDOW(sp)
  34         rd      %psr, %sw_psr
  35         LOAD_CURRENT(sw_tmp, sw_wim)
  36         rd      %wim, %sw_wim
  37         std     %sw_psr, [%sw_tmp + THREAD_KPSR]
  38         std     %sp, [%sw_tmp + THREAD_KSP]
  39 
  40         /* Load new kernel state. */
  41         wr      %sw_psr, PSR_ET, %psr
  42         WRITE_PAUSE
  43         sethi   %hi(C_LABEL(current_set)), %sw_tmp
  44         st      %sw_ntask, [%sw_tmp + %lo(C_LABEL(current_set))]
  45         ldd     [%sw_ntask + THREAD_KPSR], %sw_psr
  46         wr      %sw_psr, PSR_ET, %psr
  47         WRITE_PAUSE
  48         wr      %sw_wim, 0x0, %wim
  49         WRITE_PAUSE
  50         ldd     [%sw_ntask + THREAD_KSP], %sp
  51         LOAD_WINDOW(sp)
  52 
  53         wr      %sw_psr, 0x0, %psr              ! traps back on
  54         WRITE_PAUSE
  55 
  56         retl
  57          nop

/* [previous][next][first][last][top][bottom][index][help] */