OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [sparc/] [kernel/] [switch.S] - Blame information for rev 1624

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
/* $Id: switch.S,v 1.1 2005-12-20 09:50:43 jcastillo Exp $
2
 * switch.S: Sparc task switch code.
3
 *
4
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5
 */
6
 
7
#include 
8
#include 
9
#include 
10
#include 
11
#include 
12
#include 
13
#include 
14
#include 
15
 
16
#define sw_ntask     g1
17
#define sw_psr       g4
18
#define sw_wim       g5
19
#define sw_tmp       g6
20
#define sw_ctx       g7
21
 
22
/* Context switch code.  The new process's task_struct
23
 * ptr is passed as the first parameter.
24
 *
25
 * First successful task switch 05/13/95 21:52:37
26
 */
27
        .align 4
28
        .globl  C_LABEL(sparc_switch_to)
29
C_LABEL(sparc_switch_to):
30
        mov     %o0, %sw_ntask
31
 
32
        /* Save kernel state. */
33
        FLUSH_ALL_KERNEL_WINDOWS;
34
        STORE_WINDOW(sp)
35
        rd      %psr, %sw_psr
36
        LOAD_CURRENT(sw_tmp, sw_wim)
37
        rd      %wim, %sw_wim
38
        std     %sw_psr, [%sw_tmp + THREAD_KPSR]
39
        std     %sp, [%sw_tmp + THREAD_KSP]
40
 
41
        /* Load new kernel state. */
42
        wr      %sw_psr, PSR_ET, %psr
43
        WRITE_PAUSE
44
#ifdef __SMP__
45
        GET_PROCESSOR_OFFSET(sw_psr)
46
        set     C_LABEL(current_set), %sw_tmp
47
        st      %sw_ntask, [%sw_tmp + %sw_psr]
48
#else
49
        sethi   %hi(C_LABEL(current_set)), %sw_tmp
50
        st      %sw_ntask, [%sw_tmp + %lo(C_LABEL(current_set))]
51
#endif
52
        ldd     [%sw_ntask + THREAD_KPSR], %sw_psr
53
        wr      %sw_psr, PSR_ET, %psr
54
        WRITE_PAUSE
55
        wr      %sw_wim, 0x0, %wim
56
        WRITE_PAUSE
57
        ldd     [%sw_ntask + THREAD_KSP], %sp
58
        LOAD_WINDOW(sp)
59
 
60
        wr      %sw_psr, 0x0, %psr              ! traps back on
61
        WRITE_PAUSE
62
 
63
        retl
64
         nop
65
 
66
 
67
#ifdef __SMP__
68
        /* Because of nasty register windows this is the only way
69
         * to start a processor into its cpu_idle() thread.
70
         */
71
 
72
        .globl  C_LABEL(sparc_cpusched)
73
C_LABEL(sparc_cpusched):
74
        LOAD_CURRENT(g1, g2)
75
        rd      %psr, %g7
76
 
77
        wr      %g7, PSR_ET, %psr
78
        WRITE_PAUSE
79
 
80
        ldd     [%g1 + THREAD_KPSR], %g2
81
 
82
        wr      %g2, PSR_ET, %psr
83
        WRITE_PAUSE
84
 
85
        wr      %g3, 0x0, %wim
86
        WRITE_PAUSE
87
 
88
        ldd     [%g1 + THREAD_KSP], %sp
89
        LOAD_WINDOW(sp)
90
 
91
        wr      %g2, 0x0, %psr
92
        WRITE_PAUSE
93
 
94
        retl
95
         nop
96
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.