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_sp g2
17 #define sw_pc g3
18 #define sw_psr g4
19 #define sw_wim g5
20 #define sw_tmp g6
21 #define sw_ctx g7
22
23
24
25
26
27
28 .align 4
29 .globl C_LABEL(sparc_switch_to), C_LABEL(mmu_switch_lowlevel)
30 C_LABEL(sparc_switch_to):
31 mov %o0, %sw_ntask
32
33
34 FLUSH_ALL_KERNEL_WINDOWS;
35 STORE_WINDOW(sp)
36 rd %psr, %sw_psr
37 sethi %hi(PSR_EF), %sw_tmp
38 andn %sw_psr, %sw_tmp, %sw_psr
39 LOAD_CURRENT(sw_tmp)
40 rd %wim, %sw_wim
41 std %sw_psr, [%sw_tmp + THREAD_KPSR]
42 std %sp, [%sw_tmp + THREAD_KSP]
43
44
45 wr %sw_psr, PSR_ET, %psr
46 sethi %hi(C_LABEL(current_set)), %sw_tmp
47 st %sw_ntask, [%sw_tmp + %lo(C_LABEL(current_set))]
48 ldd [%sw_ntask + THREAD_KPSR], %sw_psr
49 ldd [%sw_ntask + THREAD_KSP], %sw_sp
50 wr %sw_psr, PSR_ET, %psr
51 WRITE_PAUSE
52 wr %sw_wim, 0x0, %wim
53 WRITE_PAUSE
54 mov %sw_sp, %sp
55 LOAD_WINDOW(sp)
56 mov %sw_pc, %o7
57
58
59 ld [%sw_ntask + THREAD_CONTEXT], %sw_ctx
60 tst %sw_ctx
61 bneg 1f ! this must be swapper
62 nop
63
64 C_LABEL(mmu_switch_lowlevel):
65 sethi %hi(AC_CONTEXT), %sw_tmp ! else set new context
66 stba %sw_ctx, [%sw_tmp] ASI_CONTROL
67 1:
68 wr %sw_psr, 0x0, %psr ! traps back on
69 WRITE_PAUSE
70
71 retl
72 nop