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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [calmrisc16/] [arch/] [v2_0/] [src/] [context.S] - Blame information for rev 565

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

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

powered by: WebSVN 2.1.0

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