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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [calmrisc16/] [arch/] [current/] [src/] [context.S] - Blame information for rev 868

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

Line No. Rev Author Line
1 786 skrzyp
##=============================================================================##
2
##      context.S
3
##
4
##      CalmRISC16 context switch code
5
##
6
##=============================================================================
7
## ####ECOSGPLCOPYRIGHTBEGIN####
8
## -------------------------------------------
9
## This file is part of eCos, the Embedded Configurable Operating System.
10
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
11
##
12
## eCos is free software; you can redistribute it and/or modify it under
13
## the terms of the GNU General Public License as published by the Free
14
## Software Foundation; either version 2 or (at your option) any later
15
## version.
16
##
17
## eCos is distributed in the hope that it will be useful, but WITHOUT
18
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
## for more details.
21
##
22
## You should have received a copy of the GNU General Public License
23
## along with eCos; if not, write to the Free Software Foundation, Inc.,
24
## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
25
##
26
## As a special exception, if other files instantiate templates or use
27
## macros or inline functions from this file, or you compile this file
28
## and link it with other works to produce a work based on this file,
29
## this file does not by itself cause the resulting work to be covered by
30
## the GNU General Public License. However the source code for this file
31
## must still be made available in accordance with section (3) of the GNU
32
## General Public License v2.
33
##
34
## This exception does not invalidate any other reasons why a work based
35
## on this file might be covered by the GNU General Public License.
36
## -------------------------------------------
37
## ####ECOSGPLCOPYRIGHTEND####
38
##=============================================================================
39
#######DESCRIPTIONBEGIN####
40
##
41
## Author(s):   msalter
42
## Contributors: msalter
43
## Date:        2001-02-12
44
## Purpose:     CalmRISC16 context switch code
45
## Description: This file contains implementations of the thread context
46
##              switch routines. It also contains the longjmp() and setjmp()
47
##              routines.
48
##
49
######DESCRIPTIONEND####
50
##
51
##=============================================================================
52
 
53
#include 
54
#include 
55
 
56
#------------------------------------------------------------------------------
57
# hal_thread_switch_context
58
# Switch thread contexts
59
# A0 = address of sp of next thread to execute
60
# A1 = address of sp save location of current thread
61
 
62
        .global hal_thread_switch_context
63
hal_thread_switch_context:
64
        // FIXME
65
        # Now load the destination thread by dropping through
66
        # to hal_thread_load_context
67
 
68
#------------------------------------------------------------------------------
69
# hal_thread_load_context
70
# Load thread context
71
# A0 = address of sp of next thread to execute
72
# Note that this function is also the second half of hal_thread_switch_context
73
# and is simply dropped into from it.
74
 
75
        .global hal_thread_load_context
76
hal_thread_load_context:
77
        // FIXME
78
 
79
#------------------------------------------------------------------------------
80
# HAL longjmp, setjmp implementations
81
# hal_setjmp saves only callee save registers into given buffer
82
# Note: These definitions are repeated in hal_arch.h. If changes are required
83
# remember to update both sets.
84
 
85
#define CYGARC_JMP_BUF_R4        0
86
#define CYGARC_JMP_BUF_R5        2
87
#define CYGARC_JMP_BUF_A12       4
88
#define CYGARC_JMP_BUF_A13       8
89
#define CYGARC_JMP_BUF_A14      12
90
#define CYGARC_JMP_BUF_A15      16
91
 
92
#define CYGARC_JMP_BUF_SIZE     20
93
 
94
// FIXME: The follwing restricts us to using only 32 bit registers
95
// in jump buffers. If/when we move to a full 64 bit architecture,
96
// this will need to change, as will the instructions that we use to
97
// save and restore them.
98
 
99
#define jmpbuf_regsize 4
100
 
101
        .globl  hal_setjmp
102
hal_setjmp:
103
        ldw     a8,@[sp+2]      // jmpbuf
104
        ldw     @[a8+0],r4
105
        ldw     @[a8+2],r5
106
        ldw     @[a8+4],a12
107
        ldw     @[a8+8],a13
108
        ldw     @[a8+12],a14
109
        ldw     @[a8+16],a15
110
        retd
111
         ld     r0,#0
112
        .end hal_setjmp
113
 
114
        .globl  hal_longjmp
115
hal_longjmp:
116
        ldw     a8,@[sp+2]
117
        ldw     r0,@[sp+6]
118
        ldw     r4,@[a8+0]
119
        ldw     r5,@[a8+2]
120
        ldw     a12,@[a8+4]
121
        ldw     a13,@[a8+8]
122
        ldw     a14,@[a8+12]
123
        ldw     a15,@[a8+16]
124
        and     r0,r0
125
        retd
126
        incc    r0
127
        .end hal_longjmp
128
 
129
 
130
#------------------------------------------------------------------------------
131
# end of context.S

powered by: WebSVN 2.1.0

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