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