Rev 470 | Rev 473 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 470 | Rev 472 | ||
---|---|---|---|
1 | # |
1 | # |
2 | # Copyright (C) 2005 Jakub Vana |
2 | # Copyright (C) 2005 Jakub Vana |
- | 3 | # Copyright (C) 2005 Jakub Jermar |
|
3 | # All rights reserved. |
4 | # All rights reserved. |
4 | # |
5 | # |
5 | # Redistribution and use in source and binary forms, with or without |
6 | # Redistribution and use in source and binary forms, with or without |
6 | # modification, are permitted provided that the following conditions |
7 | # modification, are permitted provided that the following conditions |
7 | # are met: |
8 | # are met: |
8 | # |
9 | # |
9 | # - Redistributions of source code must retain the above copyright |
10 | # - Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. |
11 | # notice, this list of conditions and the following disclaimer. |
11 | # - Redistributions in binary form must reproduce the above copyright |
12 | # - Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the |
13 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. |
14 | # documentation and/or other materials provided with the distribution. |
14 | # - The name of the author may not be used to endorse or promote products |
15 | # - The name of the author may not be used to endorse or promote products |
15 | # derived from this software without specific prior written permission. |
16 | # derived from this software without specific prior written permission. |
16 | # |
17 | # |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
28 | # |
28 | 29 | ||
29 | #include <arch/stack.h> |
30 | #include <arch/stack.h> |
- | 31 | #include <arch/register.h> |
|
30 | 32 | ||
31 | #define STACK_ITEMS 12 |
33 | #define STACK_ITEMS 12 |
32 | #define STACK_FRAME_SIZE ((STACK_ITEMS*STACK_ITEM_SIZE) + STACK_SCRATCH_AREA_SIZE) |
34 | #define STACK_FRAME_SIZE ((STACK_ITEMS*STACK_ITEM_SIZE) + STACK_SCRATCH_AREA_SIZE) |
33 | 35 | ||
34 | #if (STACK_FRAME_SIZE % STACK_ALIGNMENT != 0) |
36 | #if (STACK_FRAME_SIZE % STACK_ALIGNMENT != 0) |
35 | #error Memory stack must be 16-byte aligned. |
37 | #error Memory stack must be 16-byte aligned. |
36 | #endif |
38 | #endif |
37 | 39 | ||
38 | /** Heavyweight interrupt handler |
40 | /** Heavyweight interrupt handler |
39 | * |
41 | * |
40 | * This macro roughly follows steps from 1 to 19 described in |
42 | * This macro roughly follows steps from 1 to 19 described in |
41 | * Intel Itanium Architecture Software Developer's Manual, Chapter 3.4.2. |
43 | * Intel Itanium Architecture Software Developer's Manual, Chapter 3.4.2. |
42 | * |
44 | * |
43 | * HEAVYWEIGHT_HANDLER macro must cram into 16 bundles (48 instructions). |
45 | * HEAVYWEIGHT_HANDLER macro must cram into 16 bundles (48 instructions). |
44 | * This goal is achieved by using procedure calls after RSE becomes operational. |
46 | * This goal is achieved by using procedure calls after RSE becomes operational. |
45 | * |
47 | * |
46 | * Some steps are skipped (enabling and disabling interrupts). |
48 | * Some steps are skipped (enabling and disabling interrupts). |
47 | * Some steps are not fully supported yet (e.g. interruptions |
49 | * Some steps are not fully supported yet (e.g. interruptions |
48 | * from userspace and floating-point context). |
50 | * from userspace and floating-point context). |
49 | * |
51 | * |
50 | * @param offs Offset from the beginning of IVT. |
52 | * @param offs Offset from the beginning of IVT. |
51 | * @param handler Interrupt handler address. |
53 | * @param handler Interrupt handler address. |
52 | */ |
54 | */ |
53 | .macro HEAVYWEIGHT_HANDLER offs, handler=universal_handler |
55 | .macro HEAVYWEIGHT_HANDLER offs, handler=universal_handler |
54 | .org ivt + \offs |
56 | .org ivt + \offs |
55 | mov r24 = \offs |
57 | mov r24 = \offs |
56 | movl r25 = \handler ;; |
58 | movl r25 = \handler ;; |
57 | mov ar.k0 = r24 |
59 | mov ar.k0 = r24 |
58 | mov ar.k1 = r25 |
60 | mov ar.k1 = r25 |
59 | br heavyweight_handler |
61 | br heavyweight_handler |
60 | .endm |
62 | .endm |
61 | 63 | ||
62 | .global heavyweight_handler |
64 | .global heavyweight_handler |
63 | heavyweight_handler: |
65 | heavyweight_handler: |
64 | /* 1. copy interrupt registers into bank 0 */ |
66 | /* 1. copy interrupt registers into bank 0 */ |
65 | mov r24 = cr.iip |
67 | mov r24 = cr.iip |
66 | mov r25 = cr.ipsr |
68 | mov r25 = cr.ipsr |
67 | mov r26 = cr.iipa |
69 | mov r26 = cr.iipa |
68 | mov r27 = cr.isr |
70 | mov r27 = cr.isr |
69 | mov r28 = cr.ifa |
71 | mov r28 = cr.ifa |
70 | 72 | ||
71 | /* 2. preserve predicate register into bank 0 */ |
73 | /* 2. preserve predicate register into bank 0 */ |
72 | mov r29 = pr ;; |
74 | mov r29 = pr ;; |
73 | 75 | ||
74 | /* 3. switch to kernel memory stack */ |
76 | /* 3. switch to kernel memory stack */ |
75 | /* TODO: support interruptions from userspace */ |
77 | /* TODO: support interruptions from userspace */ |
76 | /* assume kernel stack */ |
78 | /* assume kernel stack */ |
77 | 79 | ||
78 | add r31 = -8, r12 ;; |
80 | add r31 = -8, r12 ;; |
79 | add r12 = -STACK_FRAME_SIZE, r12 |
81 | add r12 = -STACK_FRAME_SIZE, r12 |
80 | 82 | ||
81 | /* 4. save registers in bank 0 into memory stack */ |
83 | /* 4. save registers in bank 0 into memory stack */ |
82 | st8 [r31] = r29, -8 ;; /* save predicate registers */ |
84 | st8 [r31] = r29, -8 ;; /* save predicate registers */ |
83 | 85 | ||
84 | st8 [r31] = r24, -8 ;; /* save cr.iip */ |
86 | st8 [r31] = r24, -8 ;; /* save cr.iip */ |
85 | st8 [r31] = r25, -8 ;; /* save cr.ipsr */ |
87 | st8 [r31] = r25, -8 ;; /* save cr.ipsr */ |
86 | st8 [r31] = r26, -8 ;; /* save cr.iipa */ |
88 | st8 [r31] = r26, -8 ;; /* save cr.iipa */ |
87 | st8 [r31] = r27, -8 ;; /* save cr.isr */ |
89 | st8 [r31] = r27, -8 ;; /* save cr.isr */ |
88 | st8 [r31] = r28, -8 /* save cr.ifa */ |
90 | st8 [r31] = r28, -8 /* save cr.ifa */ |
89 | 91 | ||
90 | /* 5. RSE switch from interrupted context */ |
92 | /* 5. RSE switch from interrupted context */ |
91 | mov r24 = ar.rsc |
93 | mov r24 = ar.rsc |
92 | mov r25 = ar.pfs |
94 | mov r25 = ar.pfs |
93 | cover |
95 | cover |
94 | mov r26 = cr.ifs |
96 | mov r26 = cr.ifs |
95 | 97 | ||
96 | st8 [r31] = r24, -8;; /* save ar.rsc */ |
98 | st8 [r31] = r24, -8;; /* save ar.rsc */ |
97 | st8 [r31] = r25, -8;; /* save ar.pfs */ |
99 | st8 [r31] = r25, -8;; /* save ar.pfs */ |
98 | st8 [r31] = r26, -8 /* save ar.ifs */ |
100 | st8 [r31] = r26, -8 /* save ar.ifs */ |
99 | 101 | ||
100 | and r30 = ~3, r24 ;; |
102 | and r30 = ~3, r24 ;; |
101 | mov ar.rsc = r30 ;; /* place RSE in enforced lazy mode */ |
103 | mov ar.rsc = r30 ;; /* place RSE in enforced lazy mode */ |
102 | 104 | ||
103 | mov r27 = ar.rnat |
105 | mov r27 = ar.rnat |
104 | mov r28 = ar.bspstore ;; |
106 | mov r28 = ar.bspstore ;; |
105 | 107 | ||
106 | /* assume kernel backing store */ |
108 | /* assume kernel backing store */ |
107 | mov ar.bspstore = r28 ;; |
109 | mov ar.bspstore = r28 ;; |
108 | 110 | ||
109 | mov r29 = ar.bsp |
111 | mov r29 = ar.bsp |
110 | 112 | ||
111 | st8 [r31] = r27, -8 ;; /* save ar.rnat */ |
113 | st8 [r31] = r27, -8 ;; /* save ar.rnat */ |
112 | st8 [r31] = r28, -8 ;; /* save ar.bspstore */ |
114 | st8 [r31] = r28, -8 ;; /* save ar.bspstore */ |
113 | st8 [r31] = r29, -8 /* save ar.bsp */ |
115 | st8 [r31] = r29, -8 /* save ar.bsp */ |
114 | 116 | ||
115 | mov ar.rsc = r24 /* restore RSE's setting */ |
117 | mov ar.rsc = r24 /* restore RSE's setting */ |
116 | 118 | ||
117 | /* steps 6 - 15 are done by heavyweight_handler_inner() */ |
119 | /* steps 6 - 15 are done by heavyweight_handler_inner() */ |
118 | mov r24 = b0 /* save b0 belonging to interrupted context */ |
120 | mov r24 = b0 /* save b0 belonging to interrupted context */ |
119 | mov r26 = ar.k0 |
121 | mov r26 = ar.k0 |
120 | mov r25 = ar.k1 |
122 | mov r25 = ar.k1 |
121 | br.call.sptk.many rp = heavyweight_handler_inner |
123 | br.call.sptk.many rp = heavyweight_handler_inner |
122 | 0: mov b0 = r24 /* restore b0 belonging to the interrupted context */ |
124 | 0: mov b0 = r24 /* restore b0 belonging to the interrupted context */ |
123 | 125 | ||
124 | /* 16. RSE switch to interrupted context */ |
126 | /* 16. RSE switch to interrupted context */ |
125 | cover /* allocate zerro size frame (step 1 (from Intel Docs)) */ |
127 | cover /* allocate zerro size frame (step 1 (from Intel Docs)) */ |
126 | 128 | ||
127 | add r31 = STACK_SCRATCH_AREA_SIZE, r12 ;; |
129 | add r31 = STACK_SCRATCH_AREA_SIZE, r12 ;; |
128 | 130 | ||
129 | mov r28 = ar.bspstore /* calculate loadrs (step 2) */ |
131 | mov r28 = ar.bspstore /* calculate loadrs (step 2) */ |
130 | ld8 r29 = [r31], +8 ;; /* load ar.bsp */ |
132 | ld8 r29 = [r31], +8 ;; /* load ar.bsp */ |
131 | sub r27 = r29 , r28 ;; |
133 | sub r27 = r29 , r28 ;; |
132 | shl r27 = r27, 16 |
134 | shl r27 = r27, 16 |
133 | 135 | ||
134 | mov r24 = ar.rsc ;; |
136 | mov r24 = ar.rsc ;; |
135 | and r30 = ~3, r24 ;; |
137 | and r30 = ~3, r24 ;; |
136 | or r24 = r30 , r27 ;; |
138 | or r24 = r30 , r27 ;; |
137 | mov ar.rsc = r24 ;; /* place RSE in enforced lazy mode */ |
139 | mov ar.rsc = r24 ;; /* place RSE in enforced lazy mode */ |
138 | 140 | ||
139 | loadrs /* (step 3) */ |
141 | loadrs /* (step 3) */ |
140 | 142 | ||
141 | ld8 r28 = [r31], +8 ;; /* load ar.bspstore */ |
143 | ld8 r28 = [r31], +8 ;; /* load ar.bspstore */ |
142 | ld8 r27 = [r31], +8 ;; /* load ar.rnat */ |
144 | ld8 r27 = [r31], +8 ;; /* load ar.rnat */ |
143 | ld8 r26 = [r31], +8 ;; /* load cr.ifs */ |
145 | ld8 r26 = [r31], +8 ;; /* load cr.ifs */ |
144 | ld8 r25 = [r31], +8 ;; /* load ar.pfs */ |
146 | ld8 r25 = [r31], +8 ;; /* load ar.pfs */ |
145 | ld8 r24 = [r31], +8 ;; /* load ar.rsc */ |
147 | ld8 r24 = [r31], +8 ;; /* load ar.rsc */ |
146 | 148 | ||
147 | mov ar.bspstore = r28 ;; /* (step 4) */ |
149 | mov ar.bspstore = r28 ;; /* (step 4) */ |
148 | mov ar.rnat = r27 /* (step 5) */ |
150 | mov ar.rnat = r27 /* (step 5) */ |
149 | 151 | ||
150 | mov ar.pfs = r25 /* (step 6) */ |
152 | mov ar.pfs = r25 /* (step 6) */ |
151 | mov cr.ifs = r26 |
153 | mov cr.ifs = r26 |
152 | 154 | ||
153 | mov ar.rsc = r24 /* (step 7) */ |
155 | mov ar.rsc = r24 /* (step 7) */ |
154 | 156 | ||
155 | /* 17. restore interruption state from memory stack */ |
157 | /* 17. restore interruption state from memory stack */ |
156 | ld8 r28 = [r31], +8 ;; /* load cr.ifa */ |
158 | ld8 r28 = [r31], +8 ;; /* load cr.ifa */ |
157 | ld8 r27 = [r31], +8 ;; /* load cr.isr */ |
159 | ld8 r27 = [r31], +8 ;; /* load cr.isr */ |
158 | ld8 r26 = [r31], +8 ;; /* load cr.iipa */ |
160 | ld8 r26 = [r31], +8 ;; /* load cr.iipa */ |
159 | ld8 r25 = [r31], +8 ;; /* load cr.ipsr */ |
161 | ld8 r25 = [r31], +8 ;; /* load cr.ipsr */ |
160 | ld8 r24 = [r31], +8 ;; /* load cr.iip */ |
162 | ld8 r24 = [r31], +8 ;; /* load cr.iip */ |
161 | 163 | ||
162 | mov cr.iip = r24 |
164 | mov cr.iip = r24 |
163 | mov cr.ipsr = r25 |
165 | mov cr.ipsr = r25 |
164 | mov cr.iipa = r26 |
166 | mov cr.iipa = r26 |
165 | mov cr.isr = r27 |
167 | mov cr.isr = r27 |
166 | mov cr.ifa = r28 |
168 | mov cr.ifa = r28 |
167 | 169 | ||
168 | /* 18. restore predicate registers from memory stack */ |
170 | /* 18. restore predicate registers from memory stack */ |
169 | ld8 r29 = [r31] , -8 ;; /* load predicate registers */ |
171 | ld8 r29 = [r31] , -8 ;; /* load predicate registers */ |
170 | mov pr = r29 |
172 | mov pr = r29 |
171 | 173 | ||
172 | /* 19. return from interruption */ |
174 | /* 19. return from interruption */ |
173 | add r12 = STACK_FRAME_SIZE, r12 |
175 | add r12 = STACK_FRAME_SIZE, r12 |
174 | rfi ;; |
176 | rfi ;; |
175 | 177 | ||
176 | .global heavyweight_handler_inner |
178 | .global heavyweight_handler_inner |
177 | heavyweight_handler_inner: |
179 | heavyweight_handler_inner: |
178 | /* |
180 | /* |
179 | * From this point, the rest of the interrupted context |
181 | * From this point, the rest of the interrupted context |
180 | * will be preserved in stacked registers and backing store. |
182 | * will be preserved in stacked registers and backing store. |
181 | */ |
183 | */ |
182 | alloc loc0 = ar.pfs, 0, 47, 2, 0 ;; |
184 | alloc loc0 = ar.pfs, 0, 47, 2, 0 ;; |
183 | 185 | ||
184 | /* bank 0 is going to be shadowed, copy essential data from there */ |
186 | /* bank 0 is going to be shadowed, copy essential data from there */ |
185 | mov loc1 = r24 /* b0 belonging to interrupted context */ |
187 | mov loc1 = r24 /* b0 belonging to interrupted context */ |
186 | mov loc2 = r25 |
188 | mov loc2 = r25 |
187 | mov out0 = r26 |
189 | mov out0 = r26 |
188 | 190 | ||
189 | add out1 = STACK_SCRATCH_AREA_SIZE, r12 |
191 | add out1 = STACK_SCRATCH_AREA_SIZE, r12 |
190 | 192 | ||
191 | /* 6. switch to bank 1 and reenable PSR.ic */ |
193 | /* 6. switch to bank 1 and reenable PSR.ic */ |
192 | ssm 0x2000 |
194 | ssm PSR_IC_MASK |
193 | bsw.1 ;; |
195 | bsw.1 ;; |
194 | srlz.d |
196 | srlz.d |
195 | 197 | ||
196 | /* 7. preserve branch and application registers */ |
198 | /* 7. preserve branch and application registers */ |
197 | mov loc3 = ar.unat |
199 | mov loc3 = ar.unat |
198 | mov loc4 = ar.lc |
200 | mov loc4 = ar.lc |
199 | mov loc5 = ar.ec |
201 | mov loc5 = ar.ec |
200 | mov loc6 = ar.ccv |
202 | mov loc6 = ar.ccv |
201 | mov loc7 = ar.csd |
203 | mov loc7 = ar.csd |
202 | mov loc8 = ar.ssd |
204 | mov loc8 = ar.ssd |
203 | 205 | ||
204 | mov loc9 = b0 |
206 | mov loc9 = b0 |
205 | mov loc10 = b1 |
207 | mov loc10 = b1 |
206 | mov loc11 = b2 |
208 | mov loc11 = b2 |
207 | mov loc12 = b3 |
209 | mov loc12 = b3 |
208 | mov loc13 = b4 |
210 | mov loc13 = b4 |
209 | mov loc14 = b5 |
211 | mov loc14 = b5 |
210 | mov loc15 = b6 |
212 | mov loc15 = b6 |
211 | mov loc16 = b7 |
213 | mov loc16 = b7 |
212 | 214 | ||
213 | /* 8. preserve general and floating-point registers */ |
215 | /* 8. preserve general and floating-point registers */ |
214 | /* TODO: save floating-point context */ |
216 | /* TODO: save floating-point context */ |
215 | mov loc17 = r1 |
217 | mov loc17 = r1 |
216 | mov loc18 = r2 |
218 | mov loc18 = r2 |
217 | mov loc19 = r3 |
219 | mov loc19 = r3 |
218 | mov loc20 = r4 |
220 | mov loc20 = r4 |
219 | mov loc21 = r5 |
221 | mov loc21 = r5 |
220 | mov loc22 = r6 |
222 | mov loc22 = r6 |
221 | mov loc23 = r7 |
223 | mov loc23 = r7 |
222 | mov loc24 = r8 |
224 | mov loc24 = r8 |
223 | mov loc25 = r9 |
225 | mov loc25 = r9 |
224 | mov loc26 = r10 |
226 | mov loc26 = r10 |
225 | mov loc27 = r11 |
227 | mov loc27 = r11 |
226 | /* skip r12 (stack pointer) */ |
228 | /* skip r12 (stack pointer) */ |
227 | mov loc28 = r13 |
229 | mov loc28 = r13 |
228 | mov loc29 = r14 |
230 | mov loc29 = r14 |
229 | mov loc30 = r15 |
231 | mov loc30 = r15 |
230 | mov loc31 = r16 |
232 | mov loc31 = r16 |
231 | mov loc32 = r17 |
233 | mov loc32 = r17 |
232 | mov loc33 = r18 |
234 | mov loc33 = r18 |
233 | mov loc34 = r19 |
235 | mov loc34 = r19 |
234 | mov loc35 = r20 |
236 | mov loc35 = r20 |
235 | mov loc36 = r21 |
237 | mov loc36 = r21 |
236 | mov loc37 = r22 |
238 | mov loc37 = r22 |
237 | mov loc38 = r23 |
239 | mov loc38 = r23 |
238 | mov loc39 = r24 |
240 | mov loc39 = r24 |
239 | mov loc40 = r25 |
241 | mov loc40 = r25 |
240 | mov loc41 = r26 |
242 | mov loc41 = r26 |
241 | mov loc42 = r27 |
243 | mov loc42 = r27 |
242 | mov loc43 = r28 |
244 | mov loc43 = r28 |
243 | mov loc44 = r29 |
245 | mov loc44 = r29 |
244 | mov loc45 = r30 |
246 | mov loc45 = r30 |
245 | mov loc46 = r31 |
247 | mov loc46 = r31 |
246 | 248 | ||
247 | /* 9. skipped (will not enable interrupts) */ |
249 | /* 9. skipped (will not enable interrupts) */ |
248 | 250 | ||
249 | /* 10. call handler */ |
251 | /* 10. call handler */ |
250 | mov b1 = loc2 |
252 | mov b1 = loc2 |
251 | br.call.sptk.many b0 = b1 |
253 | br.call.sptk.many b0 = b1 |
252 | 254 | ||
253 | /* 11. return from handler */ |
255 | /* 11. return from handler */ |
254 | 0: |
256 | 0: |
255 | 257 | ||
256 | /* 12. skipped (will not disable interrupts) */ |
258 | /* 12. skipped (will not disable interrupts) */ |
257 | 259 | ||
258 | /* 13. restore general and floating-point registers */ |
260 | /* 13. restore general and floating-point registers */ |
259 | /* TODO: restore floating-point context */ |
261 | /* TODO: restore floating-point context */ |
260 | mov r1 = loc17 |
262 | mov r1 = loc17 |
261 | mov r2 = loc18 |
263 | mov r2 = loc18 |
262 | mov r3 = loc19 |
264 | mov r3 = loc19 |
263 | mov r4 = loc20 |
265 | mov r4 = loc20 |
264 | mov r5 = loc21 |
266 | mov r5 = loc21 |
265 | mov r6 = loc22 |
267 | mov r6 = loc22 |
266 | mov r7 = loc23 |
268 | mov r7 = loc23 |
267 | mov r8 = loc24 |
269 | mov r8 = loc24 |
268 | mov r9 = loc25 |
270 | mov r9 = loc25 |
269 | mov r10 = loc26 |
271 | mov r10 = loc26 |
270 | mov r11 = loc27 |
272 | mov r11 = loc27 |
271 | /* skip r12 (stack pointer) */ |
273 | /* skip r12 (stack pointer) */ |
272 | mov r13 = loc28 |
274 | mov r13 = loc28 |
273 | mov r14 = loc29 |
275 | mov r14 = loc29 |
274 | mov r15 = loc30 |
276 | mov r15 = loc30 |
275 | mov r16 = loc31 |
277 | mov r16 = loc31 |
276 | mov r17 = loc32 |
278 | mov r17 = loc32 |
277 | mov r18 = loc33 |
279 | mov r18 = loc33 |
278 | mov r19 = loc34 |
280 | mov r19 = loc34 |
279 | mov r20 = loc35 |
281 | mov r20 = loc35 |
280 | mov r21 = loc36 |
282 | mov r21 = loc36 |
281 | mov r22 = loc37 |
283 | mov r22 = loc37 |
282 | mov r23 = loc38 |
284 | mov r23 = loc38 |
283 | mov r24 = loc39 |
285 | mov r24 = loc39 |
284 | mov r25 = loc40 |
286 | mov r25 = loc40 |
285 | mov r26 = loc41 |
287 | mov r26 = loc41 |
286 | mov r27 = loc42 |
288 | mov r27 = loc42 |
287 | mov r28 = loc43 |
289 | mov r28 = loc43 |
288 | mov r29 = loc44 |
290 | mov r29 = loc44 |
289 | mov r30 = loc45 |
291 | mov r30 = loc45 |
290 | mov r31 = loc46 |
292 | mov r31 = loc46 |
291 | 293 | ||
292 | /* 14. restore branch and application registers */ |
294 | /* 14. restore branch and application registers */ |
293 | mov ar.unat = loc3 |
295 | mov ar.unat = loc3 |
294 | mov ar.lc = loc4 |
296 | mov ar.lc = loc4 |
295 | mov ar.ec = loc5 |
297 | mov ar.ec = loc5 |
296 | mov ar.ccv = loc6 |
298 | mov ar.ccv = loc6 |
297 | mov ar.csd = loc7 |
299 | mov ar.csd = loc7 |
298 | mov ar.ssd = loc8 |
300 | mov ar.ssd = loc8 |
299 | 301 | ||
300 | mov b0 = loc9 |
302 | mov b0 = loc9 |
301 | mov b1 = loc10 |
303 | mov b1 = loc10 |
302 | mov b2 = loc11 |
304 | mov b2 = loc11 |
303 | mov b3 = loc12 |
305 | mov b3 = loc12 |
304 | mov b4 = loc13 |
306 | mov b4 = loc13 |
305 | mov b5 = loc14 |
307 | mov b5 = loc14 |
306 | mov b6 = loc15 |
308 | mov b6 = loc15 |
307 | mov b7 = loc16 |
309 | mov b7 = loc16 |
308 | 310 | ||
309 | /* 15. disable PSR.ic and switch to bank 0 */ |
311 | /* 15. disable PSR.ic and switch to bank 0 */ |
310 | rsm 0x2000 |
312 | rsm PSR_IC_MASK |
311 | bsw.0 ;; |
313 | bsw.0 ;; |
312 | srlz.d |
314 | srlz.d |
313 | 315 | ||
314 | mov r24 = loc1 |
316 | mov r24 = loc1 |
315 | mov ar.pfs = loc0 |
317 | mov ar.pfs = loc0 |
316 | br.ret.sptk.many b0 |
318 | br.ret.sptk.many b0 |
317 | 319 | ||
318 | .global ivt |
320 | .global ivt |
319 | .align 32768 |
321 | .align 32768 |
320 | ivt: |
322 | ivt: |
321 | HEAVYWEIGHT_HANDLER 0x0000 |
323 | HEAVYWEIGHT_HANDLER 0x0000 |
322 | HEAVYWEIGHT_HANDLER 0x0400 |
324 | HEAVYWEIGHT_HANDLER 0x0400 |
323 | HEAVYWEIGHT_HANDLER 0x0800 |
325 | HEAVYWEIGHT_HANDLER 0x0800 |
324 | HEAVYWEIGHT_HANDLER 0x0c00 |
326 | HEAVYWEIGHT_HANDLER 0x0c00 |
325 | HEAVYWEIGHT_HANDLER 0x1000 |
327 | HEAVYWEIGHT_HANDLER 0x1000 |
326 | HEAVYWEIGHT_HANDLER 0x1400 |
328 | HEAVYWEIGHT_HANDLER 0x1400 |
327 | HEAVYWEIGHT_HANDLER 0x1800 |
329 | HEAVYWEIGHT_HANDLER 0x1800 |
328 | HEAVYWEIGHT_HANDLER 0x1c00 |
330 | HEAVYWEIGHT_HANDLER 0x1c00 |
329 | HEAVYWEIGHT_HANDLER 0x2000 |
331 | HEAVYWEIGHT_HANDLER 0x2000 |
330 | HEAVYWEIGHT_HANDLER 0x2400 |
332 | HEAVYWEIGHT_HANDLER 0x2400 |
331 | HEAVYWEIGHT_HANDLER 0x2800 |
333 | HEAVYWEIGHT_HANDLER 0x2800 |
332 | HEAVYWEIGHT_HANDLER 0x2c00 break_instruction |
334 | HEAVYWEIGHT_HANDLER 0x2c00 break_instruction |
333 | HEAVYWEIGHT_HANDLER 0x3000 external_interrupt /* For external interrupt, heavyweight handler is used. */ |
335 | HEAVYWEIGHT_HANDLER 0x3000 external_interrupt /* For external interrupt, heavyweight handler is used. */ |
334 | HEAVYWEIGHT_HANDLER 0x3400 |
336 | HEAVYWEIGHT_HANDLER 0x3400 |
335 | HEAVYWEIGHT_HANDLER 0x3800 |
337 | HEAVYWEIGHT_HANDLER 0x3800 |
336 | HEAVYWEIGHT_HANDLER 0x3c00 |
338 | HEAVYWEIGHT_HANDLER 0x3c00 |
337 | HEAVYWEIGHT_HANDLER 0x4000 |
339 | HEAVYWEIGHT_HANDLER 0x4000 |
338 | HEAVYWEIGHT_HANDLER 0x4400 |
340 | HEAVYWEIGHT_HANDLER 0x4400 |
339 | HEAVYWEIGHT_HANDLER 0x4800 |
341 | HEAVYWEIGHT_HANDLER 0x4800 |
340 | HEAVYWEIGHT_HANDLER 0x4c00 |
342 | HEAVYWEIGHT_HANDLER 0x4c00 |
341 | 343 | ||
342 | HEAVYWEIGHT_HANDLER 0x5000 |
344 | HEAVYWEIGHT_HANDLER 0x5000 |
343 | HEAVYWEIGHT_HANDLER 0x5100 |
345 | HEAVYWEIGHT_HANDLER 0x5100 |
344 | HEAVYWEIGHT_HANDLER 0x5200 |
346 | HEAVYWEIGHT_HANDLER 0x5200 |
345 | HEAVYWEIGHT_HANDLER 0x5300 |
347 | HEAVYWEIGHT_HANDLER 0x5300 |
346 | HEAVYWEIGHT_HANDLER 0x5400 general_exception |
348 | HEAVYWEIGHT_HANDLER 0x5400 general_exception |
347 | HEAVYWEIGHT_HANDLER 0x5500 |
349 | HEAVYWEIGHT_HANDLER 0x5500 |
348 | HEAVYWEIGHT_HANDLER 0x5600 |
350 | HEAVYWEIGHT_HANDLER 0x5600 |
349 | HEAVYWEIGHT_HANDLER 0x5700 |
351 | HEAVYWEIGHT_HANDLER 0x5700 |
350 | HEAVYWEIGHT_HANDLER 0x5800 |
352 | HEAVYWEIGHT_HANDLER 0x5800 |
351 | HEAVYWEIGHT_HANDLER 0x5900 |
353 | HEAVYWEIGHT_HANDLER 0x5900 |
352 | HEAVYWEIGHT_HANDLER 0x5a00 |
354 | HEAVYWEIGHT_HANDLER 0x5a00 |
353 | HEAVYWEIGHT_HANDLER 0x5b00 |
355 | HEAVYWEIGHT_HANDLER 0x5b00 |
354 | HEAVYWEIGHT_HANDLER 0x5c00 |
356 | HEAVYWEIGHT_HANDLER 0x5c00 |
355 | HEAVYWEIGHT_HANDLER 0x5d00 |
357 | HEAVYWEIGHT_HANDLER 0x5d00 |
356 | HEAVYWEIGHT_HANDLER 0x5e00 |
358 | HEAVYWEIGHT_HANDLER 0x5e00 |
357 | HEAVYWEIGHT_HANDLER 0x5f00 |
359 | HEAVYWEIGHT_HANDLER 0x5f00 |
358 | 360 | ||
359 | HEAVYWEIGHT_HANDLER 0x6000 |
361 | HEAVYWEIGHT_HANDLER 0x6000 |
360 | HEAVYWEIGHT_HANDLER 0x6100 |
362 | HEAVYWEIGHT_HANDLER 0x6100 |
361 | HEAVYWEIGHT_HANDLER 0x6200 |
363 | HEAVYWEIGHT_HANDLER 0x6200 |
362 | HEAVYWEIGHT_HANDLER 0x6300 |
364 | HEAVYWEIGHT_HANDLER 0x6300 |
363 | HEAVYWEIGHT_HANDLER 0x6400 |
365 | HEAVYWEIGHT_HANDLER 0x6400 |
364 | HEAVYWEIGHT_HANDLER 0x6500 |
366 | HEAVYWEIGHT_HANDLER 0x6500 |
365 | HEAVYWEIGHT_HANDLER 0x6600 |
367 | HEAVYWEIGHT_HANDLER 0x6600 |
366 | HEAVYWEIGHT_HANDLER 0x6700 |
368 | HEAVYWEIGHT_HANDLER 0x6700 |
367 | HEAVYWEIGHT_HANDLER 0x6800 |
369 | HEAVYWEIGHT_HANDLER 0x6800 |
368 | HEAVYWEIGHT_HANDLER 0x6900 |
370 | HEAVYWEIGHT_HANDLER 0x6900 |
369 | HEAVYWEIGHT_HANDLER 0x6a00 |
371 | HEAVYWEIGHT_HANDLER 0x6a00 |
370 | HEAVYWEIGHT_HANDLER 0x6b00 |
372 | HEAVYWEIGHT_HANDLER 0x6b00 |
371 | HEAVYWEIGHT_HANDLER 0x6c00 |
373 | HEAVYWEIGHT_HANDLER 0x6c00 |
372 | HEAVYWEIGHT_HANDLER 0x6d00 |
374 | HEAVYWEIGHT_HANDLER 0x6d00 |
373 | HEAVYWEIGHT_HANDLER 0x6e00 |
375 | HEAVYWEIGHT_HANDLER 0x6e00 |
374 | HEAVYWEIGHT_HANDLER 0x6f00 |
376 | HEAVYWEIGHT_HANDLER 0x6f00 |
375 | 377 | ||
376 | HEAVYWEIGHT_HANDLER 0x7000 |
378 | HEAVYWEIGHT_HANDLER 0x7000 |
377 | HEAVYWEIGHT_HANDLER 0x7100 |
379 | HEAVYWEIGHT_HANDLER 0x7100 |
378 | HEAVYWEIGHT_HANDLER 0x7200 |
380 | HEAVYWEIGHT_HANDLER 0x7200 |
379 | HEAVYWEIGHT_HANDLER 0x7300 |
381 | HEAVYWEIGHT_HANDLER 0x7300 |
380 | HEAVYWEIGHT_HANDLER 0x7400 |
382 | HEAVYWEIGHT_HANDLER 0x7400 |
381 | HEAVYWEIGHT_HANDLER 0x7500 |
383 | HEAVYWEIGHT_HANDLER 0x7500 |
382 | HEAVYWEIGHT_HANDLER 0x7600 |
384 | HEAVYWEIGHT_HANDLER 0x7600 |
383 | HEAVYWEIGHT_HANDLER 0x7700 |
385 | HEAVYWEIGHT_HANDLER 0x7700 |
384 | HEAVYWEIGHT_HANDLER 0x7800 |
386 | HEAVYWEIGHT_HANDLER 0x7800 |
385 | HEAVYWEIGHT_HANDLER 0x7900 |
387 | HEAVYWEIGHT_HANDLER 0x7900 |
386 | HEAVYWEIGHT_HANDLER 0x7a00 |
388 | HEAVYWEIGHT_HANDLER 0x7a00 |
387 | HEAVYWEIGHT_HANDLER 0x7b00 |
389 | HEAVYWEIGHT_HANDLER 0x7b00 |
388 | HEAVYWEIGHT_HANDLER 0x7c00 |
390 | HEAVYWEIGHT_HANDLER 0x7c00 |
389 | HEAVYWEIGHT_HANDLER 0x7d00 |
391 | HEAVYWEIGHT_HANDLER 0x7d00 |
390 | HEAVYWEIGHT_HANDLER 0x7e00 |
392 | HEAVYWEIGHT_HANDLER 0x7e00 |
391 | HEAVYWEIGHT_HANDLER 0x7f00 |
393 | HEAVYWEIGHT_HANDLER 0x7f00 |
392 | 394 |