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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [sparclite/] [sleb/] [v2_0/] [src/] [hal_cygm.S] - Blame information for rev 249

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

Line No. Rev Author Line
1 27 unneback
/*=============================================================================
2
//
3
//      hal_cygm.S
4
//
5
//      SPARClite and CygMon play nice: vector service routines
6
//
7
//=============================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// 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 along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//=============================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):   hmt
44
// Contributors:hmt
45
// Date:        1998-02-24
46
// Purpose:     SPARClite vectors for interworking with CygMon
47
// Description: see vectors.S and hal_priv.c; these VSRs are installed to
48
//              interwork with CygMon.
49
//
50
//####DESCRIPTIONEND####
51
//
52
//===========================================================================*/
53
 
54
!-----------------------------------------------------------------------------
55
 
56
//      .file   "hal_cygm.S"
57
 
58
!-----------------------------------------------------------------------------
59
 
60
#include 
61
#include 
62
#include 
63
#include 
64
 
65
!------------------------------------------------------------------------
66
 
67
#include        // eCos vector number et al
68
#include        // CygMon vector number et al
69
 
70
#define DELAYS_AFTER_WRPSR_SAME_WINDOW
71
#define DELAYS_AFTER_WRWIM
72
 
73
!------------------------------------------------------------------------
74
 
75
        .text
76
 
77
!---------------------------------------------------------------------------
78
 
79
#ifdef CYG_HAL_USE_ROM_MONITOR_CYGMON
80
 
81
        .global hal_user_trap_to_cygmon_vsr
82
hal_user_trap_to_cygmon_vsr:
83
        ! here,locals have been set up as follows:
84
        ! %l0 = psr (with this CWP/window-level in it)
85
        ! %l1 = pc
86
        ! %l2 = npc
87
        ! %l3 = vector number (1-15 for interrupts)
88
        ! and we are in our own register window, though it is likely that
89
        ! the next one will need to be saved before we can use it:
90
        ! ie. this one is the invalid register window.
91
 
92
        rd      %tbr, %l4               ! Get the trap type
93
        srl     %l4, 4, %l4             ! into the bottom byte
94
        and     %l4, 0xff, %l4          ! actual trap number
95
 
96
        ! we deal with traps 1,3,8(+128) and 255 here.
97
        ! ta 1  => tt 129       :       breakpoint
98
        ! ta 3  => tt 131       :       flush windows (unneccessary, JIC)
99
        ! ta 8  => tt 136       :       syscall (apparently)
100
        ! ta 127 -OR- Debug Support Unit trap
101
        !       => tt 255       :       debug trap
102
        ! others bounce through to eCos handler, of course.
103
 
104
        cmp     %l4, 129
105
        beq     bounce_to_cygmon
106
        mov     BSP_EXC_BREAK, %l5
107
 
108
        ! ta 2 is a "skipped" breakpoint, we increment the PC, NPC
109
        ! ourselves to permit continuation.
110
        cmp     %l4, 130
111
        bne     1f
112
        nop
113
        mov     %l2, %l1
114
        add     %l2, 4, %l2
115
        b       bounce_to_cygmon
116
        mov     BSP_EXC_BREAK, %l5
117
 
118
1:
119
        cmp     %l4, 131
120
        beq     bounce_to_cygmon
121
        mov     BSP_EXC_WINFLUSH, %l5
122
 
123
        cmp     %l4, 136
124
        beq     bounce_to_cygmon
125
        mov     BSP_EXC_SYSCALL, %l5
126
 
127
        cmp     %l4, 255
128
        beq     bounce_to_cygmon
129
        mov     BSP_EXC_DEBUG, %l5
130
 
131
        ! if we are here, it~s not a recognized trap to feed to CygMon, so
132
        ! call the eCos default trap VSR:
133
        .extern hal_default_exception_vsr
134
        ba      hal_default_exception_vsr       ! should be in range
135
        nop                                     ! does not return
136
 
137
 
138
        .global hal_nofpcp_trap_to_cygmon_vsr
139
hal_nofpcp_trap_to_cygmon_vsr:
140
        rd      %tbr, %l4               ! Get the trap type
141
        srl     %l4, 4, %l4             ! into the bottom byte
142
        and     %l4, 0xff, %l4          ! actual trap number
143
        ! we deal with trap types 4 and 36 here.
144
 
145
        cmp     %l4, 4
146
        beq     bounce_to_cygmon
147
        mov     BSP_EXC_FPDIS, %l5
148
 
149
        cmp     %l4, 36
150
        beq     bounce_to_cygmon
151
        mov     BSP_EXC_CPDIS, %l5
152
 
153
        ! we really should not be here otherwise, but for best debugging...
154
        b       bounce_to_cygmon
155
        mov     BSP_EXC_TRAP, %l5
156
 
157
bounce_to_cygmon:
158
        ! here we have decided to jump over CygMon, the CygMon vector
159
        ! number to use is in %l5.
160
        set     CYGMON_VECTOR_TABLE_BASE, %l6
161
        sll     %l5, 2, %l5             ! to a word offset
162
        ! our calling convention is the same, so...
163
        ld      [ %l6 + %l5 ], %l6
164
        jmp     %l6
165
        nop
166
 
167
 
168
// Now a handler for INT15 (NMI) to assist in debugging; we have to ack and
169
// clear the interrupt, after waiting for the source to go away, I guess...
170
        .global hal_nmi_handler
171
hal_nmi_handler:
172
        ! here,locals have been set up as follows:
173
        ! %l0 = psr (with this CWP/window-level in it)
174
        ! %l1 = pc
175
        ! %l2 = npc
176
        ! %l3 = vector number (1-15 for interrupts)
177
        ! and we are in our own register window, though it is likely that
178
        ! the next one will need to be saved before we can use it:
179
        ! ie. this one is the invalid register window.
180
 
181
#define TRGM0   0
182
#define TRGM1   4
183
#define REQSNS  8
184
#define REQCLR 12
185
#define IMASK  16
186
#define IRLAT  20
187
#define IMODE  24
188
 
189
#define NMIBIT 0x80000000
190
 
191
        sethi   %hi( 0x10000000 ), %l4  ! base address of the 86940 companion
192
 
193
10:
194
        add     %l4, REQCLR, %l5        ! Request clear register
195
        set     NMIBIT, %l6
196
        sta     %l6, [ %l5 ] 4          ! Clear INT15
197
 
198
        add     %l4, REQSNS, %l5        ! Request sense register
199
        lda     [ %l5 ] 4, %l7
200
        andcc   %l6, %l7, %g0           ! test the sense bit
201
 
202
        sethi   %hi( 0x02000000 ), %l6  ! Pump it out to the LED
203
        srl     %l7, 24, %l7
204
        stb     %l7, [ %l6 + 3 ]
205
 
206
        bne     10b                     ! poll until the request is gone
207
        nop
208
        nop
209
        nop
210
 
211
        set     0x00100000, %l6         ! clear the latch
212
        add     %l4, IRLAT, %l5
213
        sta     %l6, [ %l5 ] 4
214
 
215
        nop
216
        nop
217
        nop
218
 
219
        b       bounce_to_cygmon
220
        mov     BSP_EXC_INT15, %l5
221
 
222
 
223
 
224
 
225
 
226
#endif // CYG_HAL_USE_ROM_MONITOR_CYGMON
227
 
228
! end of hal_cygm.S

powered by: WebSVN 2.1.0

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