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

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [sw/] [support/] [except.S] - Blame information for rev 49

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

Line No. Rev Author Line
1 2 rfajardo
#include "spr_defs.h"
2
 
3
// Linked from 0x200, so subtract 0x200 from each .org
4
.section .vectors, "ax"
5
 
6
/*
7
.org 0x100
8
 
9
_reset:
10 47 rfajardo
    l.nop
11
    l.j    _reset_except
12
    l.nop
13 2 rfajardo
*/
14
.org 0x000
15
 
16
_except_200:
17
    l.nop
18 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
19
                    //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
20
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
21
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
22
    l.nop
23 2 rfajardo
 
24 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
25
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
26
    l.j    buserr_except
27
    l.nop
28 2 rfajardo
 
29
.org 0x100
30
 
31
_except_300:
32
    l.nop
33 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
34
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
35
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
36
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
37
    l.nop
38 2 rfajardo
 
39 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
40
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
41
    l.j    dpf_except
42
    l.nop
43 2 rfajardo
 
44
.org 0x200
45
 
46
_except_400:
47
    l.nop
48 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
49
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
50
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
51
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
52
    l.nop
53 2 rfajardo
 
54 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
55
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
56
    l.j    ipf_except
57
    l.nop
58 2 rfajardo
 
59
.org 0x300
60
 
61
_except_500:
62
    l.nop
63 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
64
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
65
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
66
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
67
    l.nop
68 2 rfajardo
 
69 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
70
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
71
    l.j    tick_except
72
    l.nop
73 2 rfajardo
 
74
.org 0x400
75
 
76
_except_600:
77
    l.nop
78 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
79
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
80
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
81
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
82
    l.nop
83 2 rfajardo
 
84 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
85
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
86
    l.j    align_except
87
    l.nop
88 2 rfajardo
 
89
.org 0x500
90
 
91
_except_700:
92
    l.nop
93 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
94
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
95
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
96
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
97
    l.nop
98 2 rfajardo
 
99 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
100
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
101
    l.j    illegal_except
102
    l.nop
103 2 rfajardo
 
104
.org 0x600
105
 
106
_except_800:
107
    l.nop
108 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
109
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
110
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
111
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
112
    l.nop
113 2 rfajardo
 
114 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
115
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
116
    l.j ext_except                //jmp to C interrupt handler (returns later to end_except)
117 2 rfajardo
    l.nop
118
 
119
 
120
.org 0x700
121
 
122
_except_900:
123
    l.nop
124 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
125
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
126
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
127
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
128
    l.nop
129 2 rfajardo
 
130 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
131
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
132
    l.j    dtlbmiss_except
133
    l.nop
134 2 rfajardo
 
135
.org 0x800
136
 
137
_except_a00:
138
    l.nop
139 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
140
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
141
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
142
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
143
    l.nop
144 2 rfajardo
 
145 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
146
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
147
    l.j    itlbmiss_except
148
    l.nop
149 2 rfajardo
 
150
.org 0x900
151
 
152
_except_b00:
153
    l.nop
154 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
155
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
156
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
157
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
158
    l.nop
159 2 rfajardo
 
160 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
161
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
162
    l.j    range_except
163
    l.nop
164 2 rfajardo
 
165
.org 0xa00
166
 
167
_except_c00:
168
    l.nop
169 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
170
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
171
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
172
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
173
    l.nop
174 2 rfajardo
 
175 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
176
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
177
    l.j    syscall_except
178
    l.nop
179 2 rfajardo
 
180
.org 0xb00
181
 
182
_except_d00:
183
    l.nop
184 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
185
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
186
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
187
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
188
    l.nop
189 2 rfajardo
 
190 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
191
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
192
    l.j    res1_except
193
    l.nop
194 2 rfajardo
 
195
.org 0xc00
196
 
197
_except_e00:
198
    l.nop
199 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
200
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
201
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
202
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
203
    l.nop
204 2 rfajardo
 
205 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
206
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
207
    l.j    trap_except
208
    l.nop
209 2 rfajardo
 
210
.org 0xd00
211
 
212
_except_f00:
213
    l.nop
214 47 rfajardo
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
215
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
216
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
217
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
218
    l.nop
219 2 rfajardo
 
220 47 rfajardo
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
221
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
222
    l.j    res2_except
223
    l.nop
224 2 rfajardo
 
225 47 rfajardo
store_regs:        //save registers r3-r31 (except r9) to stack
226
    l.sw    0x00(r1),r3
227
    l.sw    0x04(r1),r4
228
    l.sw    0x08(r1),r5
229
    l.sw    0x0c(r1),r6
230
    l.sw    0x10(r1),r7
231
    l.sw    0x14(r1),r8
232
    l.sw    0x1c(r1),r10
233
    l.sw    0x20(r1),r11
234
    l.sw    0x24(r1),r12
235
    l.sw    0x28(r1),r13
236
    l.sw    0x2c(r1),r14
237
    l.sw    0x30(r1),r15
238
    l.sw    0x34(r1),r16
239
    l.sw    0x38(r1),r17
240
    l.sw    0x3c(r1),r18
241
    l.sw    0x40(r1),r19
242
    l.sw    0x44(r1),r20
243
    l.sw    0x48(r1),r21
244
    l.sw    0x4c(r1),r22
245
    l.sw    0x50(r1),r23
246
    l.sw    0x54(r1),r24
247
    l.sw    0x58(r1),r25
248
    l.sw    0x5c(r1),r26
249
    l.sw    0x60(r1),r27
250
    l.sw    0x64(r1),r28
251
    l.sw    0x68(r1),r29
252
    l.sw    0x6c(r1),r30
253
    l.sw    0x70(r1),r31
254
    l.jr    r9
255
    l.nop
256 2 rfajardo
 
257 47 rfajardo
end_except:        //load back registers from stack r3-r31
258
    l.lwz   r3,0x00(r1)
259
    l.lwz   r4,0x04(r1)
260
    l.lwz   r5,0x08(r1)
261
    l.lwz   r6,0x0c(r1)
262
    l.lwz   r7,0x10(r1)
263
    l.lwz   r8,0x14(r1)
264
    l.lwz   r9,0x18(r1)
265
    l.lwz   r10,0x1c(r1)
266
    l.lwz   r11,0x20(r1)
267
    l.lwz   r12,0x24(r1)
268
    l.lwz   r13,0x28(r1)
269
    l.lwz   r14,0x2c(r1)
270
    l.lwz   r15,0x30(r1)
271
    l.lwz   r16,0x34(r1)
272
    l.lwz   r17,0x38(r1)
273
    l.lwz   r18,0x3c(r1)
274
    l.lwz   r19,0x40(r1)
275
    l.lwz   r20,0x44(r1)
276
    l.lwz   r21,0x48(r1)
277
    l.lwz   r22,0x4c(r1)
278
    l.lwz   r23,0x50(r1)
279
    l.lwz   r24,0x54(r1)
280
    l.lwz   r25,0x58(r1)
281
    l.lwz   r26,0x5c(r1)
282
    l.lwz   r27,0x60(r1)
283
    l.lwz   r28,0x64(r1)
284
    l.lwz   r29,0x68(r1)
285
    l.lwz   r30,0x6c(r1)
286
    l.lwz   r31,0x70(r1)
287
    l.addi  r1,r1,244                //free stack places
288
    l.rfe                            //recover SR register and prior PC (jumps back to program)
289
    l.nop
290 2 rfajardo
 

powered by: WebSVN 2.1.0

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