1
2
3
4
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
22
23
24
25
26 .align 4
27 .globl C_LABEL(sparc_switch_to)
28 C_LABEL(sparc_switch_to):
29 mov %o0, %sw_ntask
30
31
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
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