Rev 1856 | Rev 1858 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1856 | Rev 1857 | ||
---|---|---|---|
1 | # |
1 | # |
2 | # Copyright (C) 2005 Jakub Jermar |
2 | # Copyright (C) 2005 Jakub Jermar |
3 | # All rights reserved. |
3 | # All rights reserved. |
4 | # |
4 | # |
5 | # Redistribution and use in source and binary forms, with or without |
5 | # Redistribution and use in source and binary forms, with or without |
6 | # modification, are permitted provided that the following conditions |
6 | # modification, are permitted provided that the following conditions |
7 | # are met: |
7 | # are met: |
8 | # |
8 | # |
9 | # - Redistributions of source code must retain the above copyright |
9 | # - Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. |
10 | # notice, this list of conditions and the following disclaimer. |
11 | # - Redistributions in binary form must reproduce the above copyright |
11 | # - Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the |
12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. |
13 | # documentation and/or other materials provided with the distribution. |
14 | # - The name of the author may not be used to endorse or promote products |
14 | # - The name of the author may not be used to endorse or promote products |
15 | # derived from this software without specific prior written permission. |
15 | # derived from this software without specific prior written permission. |
16 | # |
16 | # |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | # (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. |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
27 | # |
28 | 28 | ||
29 | /** |
29 | /** |
30 | * This file contains kernel trap table. |
30 | * This file contains kernel trap table. |
31 | */ |
31 | */ |
32 | 32 | ||
33 | .register %g2, #scratch |
33 | .register %g2, #scratch |
34 | .register %g3, #scratch |
34 | .register %g3, #scratch |
35 | 35 | ||
36 | .text |
36 | .text |
37 | 37 | ||
38 | #include <arch/trap/trap_table.h> |
38 | #include <arch/trap/trap_table.h> |
39 | #include <arch/trap/regwin.h> |
39 | #include <arch/trap/regwin.h> |
40 | #include <arch/trap/interrupt.h> |
40 | #include <arch/trap/interrupt.h> |
41 | #include <arch/trap/exception.h> |
41 | #include <arch/trap/exception.h> |
42 | #include <arch/trap/mmu.h> |
42 | #include <arch/trap/mmu.h> |
- | 43 | #include <arch/mm/page.h> |
|
43 | #include <arch/stack.h> |
44 | #include <arch/stack.h> |
44 | #include <arch/regdef.h> |
45 | #include <arch/regdef.h> |
45 | 46 | ||
46 | #define TABLE_SIZE TRAP_TABLE_SIZE |
47 | #define TABLE_SIZE TRAP_TABLE_SIZE |
47 | #define ENTRY_SIZE TRAP_TABLE_ENTRY_SIZE |
48 | #define ENTRY_SIZE TRAP_TABLE_ENTRY_SIZE |
48 | 49 | ||
49 | /* |
50 | /* |
50 | * Kernel trap table. |
51 | * Kernel trap table. |
51 | */ |
52 | */ |
52 | .align TABLE_SIZE |
53 | .align TABLE_SIZE |
53 | .global trap_table |
54 | .global trap_table |
54 | trap_table: |
55 | trap_table: |
55 | 56 | ||
56 | /* TT = 0x08, TL = 0, instruction_access_exception */ |
57 | /* TT = 0x08, TL = 0, instruction_access_exception */ |
57 | .org trap_table + TT_INSTRUCTION_ACCESS_EXCEPTION*ENTRY_SIZE |
58 | .org trap_table + TT_INSTRUCTION_ACCESS_EXCEPTION*ENTRY_SIZE |
58 | .global instruction_access_exception |
59 | .global instruction_access_exception |
59 | instruction_access_exception: |
60 | instruction_access_exception: |
60 | SIMPLE_HANDLER do_instruction_access_exc |
61 | SIMPLE_HANDLER do_instruction_access_exc |
61 | 62 | ||
62 | /* TT = 0x10, TL = 0, illegal_instruction */ |
63 | /* TT = 0x10, TL = 0, illegal_instruction */ |
63 | .org trap_table + TT_ILLEGAL_INSTRUCTION*ENTRY_SIZE |
64 | .org trap_table + TT_ILLEGAL_INSTRUCTION*ENTRY_SIZE |
64 | .global illegal_instruction |
65 | .global illegal_instruction |
65 | illegal_instruction: |
66 | illegal_instruction: |
66 | SIMPLE_HANDLER do_illegal_instruction |
67 | SIMPLE_HANDLER do_illegal_instruction |
67 | 68 | ||
68 | /* TT = 0x24, TL = 0, clean_window handler */ |
69 | /* TT = 0x24, TL = 0, clean_window handler */ |
69 | .org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE |
70 | .org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE |
70 | .global clean_window_handler |
71 | .global clean_window_handler |
71 | clean_window_handler: |
72 | clean_window_handler: |
72 | CLEAN_WINDOW_HANDLER |
73 | CLEAN_WINDOW_HANDLER |
73 | 74 | ||
74 | /* TT = 0x32, TL = 0, data_access_error */ |
75 | /* TT = 0x32, TL = 0, data_access_error */ |
75 | .org trap_table + TT_DATA_ACCESS_ERROR*ENTRY_SIZE |
76 | .org trap_table + TT_DATA_ACCESS_ERROR*ENTRY_SIZE |
76 | .global data_access_error |
77 | .global data_access_error |
77 | data_access_error: |
78 | data_access_error: |
78 | SIMPLE_HANDLER do_data_access_error |
79 | SIMPLE_HANDLER do_data_access_error |
79 | 80 | ||
80 | /* TT = 0x34, TL = 0, mem_address_not_aligned */ |
81 | /* TT = 0x34, TL = 0, mem_address_not_aligned */ |
81 | .org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE |
82 | .org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE |
82 | .global mem_address_not_aligned |
83 | .global mem_address_not_aligned |
83 | mem_address_not_aligned: |
84 | mem_address_not_aligned: |
84 | SIMPLE_HANDLER do_mem_address_not_aligned |
85 | SIMPLE_HANDLER do_mem_address_not_aligned |
85 | 86 | ||
86 | /* TT = 0x41, TL = 0, interrupt_level_1 handler */ |
87 | /* TT = 0x41, TL = 0, interrupt_level_1 handler */ |
87 | .org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE |
88 | .org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE |
88 | .global interrupt_level_1_handler |
89 | .global interrupt_level_1_handler |
89 | interrupt_level_1_handler: |
90 | interrupt_level_1_handler: |
90 | INTERRUPT_LEVEL_N_HANDLER 1 |
91 | INTERRUPT_LEVEL_N_HANDLER 1 |
91 | 92 | ||
92 | /* TT = 0x42, TL = 0, interrupt_level_2 handler */ |
93 | /* TT = 0x42, TL = 0, interrupt_level_2 handler */ |
93 | .org trap_table + TT_INTERRUPT_LEVEL_2*ENTRY_SIZE |
94 | .org trap_table + TT_INTERRUPT_LEVEL_2*ENTRY_SIZE |
94 | .global interrupt_level_2_handler |
95 | .global interrupt_level_2_handler |
95 | interrupt_level_2_handler: |
96 | interrupt_level_2_handler: |
96 | INTERRUPT_LEVEL_N_HANDLER 2 |
97 | INTERRUPT_LEVEL_N_HANDLER 2 |
97 | 98 | ||
98 | /* TT = 0x43, TL = 0, interrupt_level_3 handler */ |
99 | /* TT = 0x43, TL = 0, interrupt_level_3 handler */ |
99 | .org trap_table + TT_INTERRUPT_LEVEL_3*ENTRY_SIZE |
100 | .org trap_table + TT_INTERRUPT_LEVEL_3*ENTRY_SIZE |
100 | .global interrupt_level_3_handler |
101 | .global interrupt_level_3_handler |
101 | interrupt_level_3_handler: |
102 | interrupt_level_3_handler: |
102 | INTERRUPT_LEVEL_N_HANDLER 3 |
103 | INTERRUPT_LEVEL_N_HANDLER 3 |
103 | 104 | ||
104 | /* TT = 0x44, TL = 0, interrupt_level_4 handler */ |
105 | /* TT = 0x44, TL = 0, interrupt_level_4 handler */ |
105 | .org trap_table + TT_INTERRUPT_LEVEL_4*ENTRY_SIZE |
106 | .org trap_table + TT_INTERRUPT_LEVEL_4*ENTRY_SIZE |
106 | .global interrupt_level_4_handler |
107 | .global interrupt_level_4_handler |
107 | interrupt_level_4_handler: |
108 | interrupt_level_4_handler: |
108 | INTERRUPT_LEVEL_N_HANDLER 4 |
109 | INTERRUPT_LEVEL_N_HANDLER 4 |
109 | 110 | ||
110 | /* TT = 0x45, TL = 0, interrupt_level_5 handler */ |
111 | /* TT = 0x45, TL = 0, interrupt_level_5 handler */ |
111 | .org trap_table + TT_INTERRUPT_LEVEL_5*ENTRY_SIZE |
112 | .org trap_table + TT_INTERRUPT_LEVEL_5*ENTRY_SIZE |
112 | .global interrupt_level_5_handler |
113 | .global interrupt_level_5_handler |
113 | interrupt_level_5_handler: |
114 | interrupt_level_5_handler: |
114 | INTERRUPT_LEVEL_N_HANDLER 5 |
115 | INTERRUPT_LEVEL_N_HANDLER 5 |
115 | 116 | ||
116 | /* TT = 0x46, TL = 0, interrupt_level_6 handler */ |
117 | /* TT = 0x46, TL = 0, interrupt_level_6 handler */ |
117 | .org trap_table + TT_INTERRUPT_LEVEL_6*ENTRY_SIZE |
118 | .org trap_table + TT_INTERRUPT_LEVEL_6*ENTRY_SIZE |
118 | .global interrupt_level_6_handler |
119 | .global interrupt_level_6_handler |
119 | interrupt_level_6_handler: |
120 | interrupt_level_6_handler: |
120 | INTERRUPT_LEVEL_N_HANDLER 6 |
121 | INTERRUPT_LEVEL_N_HANDLER 6 |
121 | 122 | ||
122 | /* TT = 0x47, TL = 0, interrupt_level_7 handler */ |
123 | /* TT = 0x47, TL = 0, interrupt_level_7 handler */ |
123 | .org trap_table + TT_INTERRUPT_LEVEL_7*ENTRY_SIZE |
124 | .org trap_table + TT_INTERRUPT_LEVEL_7*ENTRY_SIZE |
124 | .global interrupt_level_7_handler |
125 | .global interrupt_level_7_handler |
125 | interrupt_level_7_handler: |
126 | interrupt_level_7_handler: |
126 | INTERRUPT_LEVEL_N_HANDLER 7 |
127 | INTERRUPT_LEVEL_N_HANDLER 7 |
127 | 128 | ||
128 | /* TT = 0x48, TL = 0, interrupt_level_8 handler */ |
129 | /* TT = 0x48, TL = 0, interrupt_level_8 handler */ |
129 | .org trap_table + TT_INTERRUPT_LEVEL_8*ENTRY_SIZE |
130 | .org trap_table + TT_INTERRUPT_LEVEL_8*ENTRY_SIZE |
130 | .global interrupt_level_8_handler |
131 | .global interrupt_level_8_handler |
131 | interrupt_level_8_handler: |
132 | interrupt_level_8_handler: |
132 | INTERRUPT_LEVEL_N_HANDLER 8 |
133 | INTERRUPT_LEVEL_N_HANDLER 8 |
133 | 134 | ||
134 | /* TT = 0x49, TL = 0, interrupt_level_9 handler */ |
135 | /* TT = 0x49, TL = 0, interrupt_level_9 handler */ |
135 | .org trap_table + TT_INTERRUPT_LEVEL_9*ENTRY_SIZE |
136 | .org trap_table + TT_INTERRUPT_LEVEL_9*ENTRY_SIZE |
136 | .global interrupt_level_9_handler |
137 | .global interrupt_level_9_handler |
137 | interrupt_level_9_handler: |
138 | interrupt_level_9_handler: |
138 | INTERRUPT_LEVEL_N_HANDLER 9 |
139 | INTERRUPT_LEVEL_N_HANDLER 9 |
139 | 140 | ||
140 | /* TT = 0x4a, TL = 0, interrupt_level_10 handler */ |
141 | /* TT = 0x4a, TL = 0, interrupt_level_10 handler */ |
141 | .org trap_table + TT_INTERRUPT_LEVEL_10*ENTRY_SIZE |
142 | .org trap_table + TT_INTERRUPT_LEVEL_10*ENTRY_SIZE |
142 | .global interrupt_level_10_handler |
143 | .global interrupt_level_10_handler |
143 | interrupt_level_10_handler: |
144 | interrupt_level_10_handler: |
144 | INTERRUPT_LEVEL_N_HANDLER 10 |
145 | INTERRUPT_LEVEL_N_HANDLER 10 |
145 | 146 | ||
146 | /* TT = 0x4b, TL = 0, interrupt_level_11 handler */ |
147 | /* TT = 0x4b, TL = 0, interrupt_level_11 handler */ |
147 | .org trap_table + TT_INTERRUPT_LEVEL_11*ENTRY_SIZE |
148 | .org trap_table + TT_INTERRUPT_LEVEL_11*ENTRY_SIZE |
148 | .global interrupt_level_11_handler |
149 | .global interrupt_level_11_handler |
149 | interrupt_level_11_handler: |
150 | interrupt_level_11_handler: |
150 | INTERRUPT_LEVEL_N_HANDLER 11 |
151 | INTERRUPT_LEVEL_N_HANDLER 11 |
151 | 152 | ||
152 | /* TT = 0x4c, TL = 0, interrupt_level_12 handler */ |
153 | /* TT = 0x4c, TL = 0, interrupt_level_12 handler */ |
153 | .org trap_table + TT_INTERRUPT_LEVEL_12*ENTRY_SIZE |
154 | .org trap_table + TT_INTERRUPT_LEVEL_12*ENTRY_SIZE |
154 | .global interrupt_level_12_handler |
155 | .global interrupt_level_12_handler |
155 | interrupt_level_12_handler: |
156 | interrupt_level_12_handler: |
156 | INTERRUPT_LEVEL_N_HANDLER 12 |
157 | INTERRUPT_LEVEL_N_HANDLER 12 |
157 | 158 | ||
158 | /* TT = 0x4d, TL = 0, interrupt_level_13 handler */ |
159 | /* TT = 0x4d, TL = 0, interrupt_level_13 handler */ |
159 | .org trap_table + TT_INTERRUPT_LEVEL_13*ENTRY_SIZE |
160 | .org trap_table + TT_INTERRUPT_LEVEL_13*ENTRY_SIZE |
160 | .global interrupt_level_13_handler |
161 | .global interrupt_level_13_handler |
161 | interrupt_level_13_handler: |
162 | interrupt_level_13_handler: |
162 | INTERRUPT_LEVEL_N_HANDLER 13 |
163 | INTERRUPT_LEVEL_N_HANDLER 13 |
163 | 164 | ||
164 | /* TT = 0x4e, TL = 0, interrupt_level_14 handler */ |
165 | /* TT = 0x4e, TL = 0, interrupt_level_14 handler */ |
165 | .org trap_table + TT_INTERRUPT_LEVEL_14*ENTRY_SIZE |
166 | .org trap_table + TT_INTERRUPT_LEVEL_14*ENTRY_SIZE |
166 | .global interrupt_level_14_handler |
167 | .global interrupt_level_14_handler |
167 | interrupt_level_14_handler: |
168 | interrupt_level_14_handler: |
168 | INTERRUPT_LEVEL_N_HANDLER 14 |
169 | INTERRUPT_LEVEL_N_HANDLER 14 |
169 | 170 | ||
170 | /* TT = 0x4f, TL = 0, interrupt_level_15 handler */ |
171 | /* TT = 0x4f, TL = 0, interrupt_level_15 handler */ |
171 | .org trap_table + TT_INTERRUPT_LEVEL_15*ENTRY_SIZE |
172 | .org trap_table + TT_INTERRUPT_LEVEL_15*ENTRY_SIZE |
172 | .global interrupt_level_15_handler |
173 | .global interrupt_level_15_handler |
173 | interrupt_level_15_handler: |
174 | interrupt_level_15_handler: |
174 | INTERRUPT_LEVEL_N_HANDLER 15 |
175 | INTERRUPT_LEVEL_N_HANDLER 15 |
175 | 176 | ||
176 | /* TT = 0x60, TL = 0, interrupt_vector_trap handler */ |
177 | /* TT = 0x60, TL = 0, interrupt_vector_trap handler */ |
177 | .org trap_table + TT_INTERRUPT_VECTOR_TRAP*ENTRY_SIZE |
178 | .org trap_table + TT_INTERRUPT_VECTOR_TRAP*ENTRY_SIZE |
178 | .global interrupt_vector_trap_handler |
179 | .global interrupt_vector_trap_handler |
179 | interrupt_vector_trap_handler: |
180 | interrupt_vector_trap_handler: |
180 | INTERRUPT_VECTOR_TRAP_HANDLER |
181 | INTERRUPT_VECTOR_TRAP_HANDLER |
181 | 182 | ||
182 | /* TT = 0x64, TL = 0, fast_instruction_access_MMU_miss */ |
183 | /* TT = 0x64, TL = 0, fast_instruction_access_MMU_miss */ |
183 | .org trap_table + TT_FAST_INSTRUCTION_ACCESS_MMU_MISS*ENTRY_SIZE |
184 | .org trap_table + TT_FAST_INSTRUCTION_ACCESS_MMU_MISS*ENTRY_SIZE |
184 | .global fast_instruction_access_mmu_miss_handler |
185 | .global fast_instruction_access_mmu_miss_handler |
185 | fast_instruction_access_mmu_miss_handler: |
186 | fast_instruction_access_mmu_miss_handler: |
186 | FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER |
187 | FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER |
187 | 188 | ||
188 | /* TT = 0x68, TL = 0, fast_data_access_MMU_miss */ |
189 | /* TT = 0x68, TL = 0, fast_data_access_MMU_miss */ |
189 | .org trap_table + TT_FAST_DATA_ACCESS_MMU_MISS*ENTRY_SIZE |
190 | .org trap_table + TT_FAST_DATA_ACCESS_MMU_MISS*ENTRY_SIZE |
190 | .global fast_data_access_mmu_miss_handler |
191 | .global fast_data_access_mmu_miss_handler |
191 | fast_data_access_mmu_miss_handler: |
192 | fast_data_access_mmu_miss_handler: |
192 | FAST_DATA_ACCESS_MMU_MISS_HANDLER |
193 | FAST_DATA_ACCESS_MMU_MISS_HANDLER |
193 | 194 | ||
194 | /* TT = 0x6c, TL = 0, fast_data_access_protection */ |
195 | /* TT = 0x6c, TL = 0, fast_data_access_protection */ |
195 | .org trap_table + TT_FAST_DATA_ACCESS_PROTECTION*ENTRY_SIZE |
196 | .org trap_table + TT_FAST_DATA_ACCESS_PROTECTION*ENTRY_SIZE |
196 | .global fast_data_access_protection_handler |
197 | .global fast_data_access_protection_handler |
197 | fast_data_access_protection_handler: |
198 | fast_data_access_protection_handler: |
198 | FAST_DATA_ACCESS_PROTECTION_HANDLER |
199 | FAST_DATA_ACCESS_PROTECTION_HANDLER |
199 | 200 | ||
200 | /* TT = 0x80, TL = 0, spill_0_normal handler */ |
201 | /* TT = 0x80, TL = 0, spill_0_normal handler */ |
201 | .org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE |
202 | .org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE |
202 | .global spill_0_normal |
203 | .global spill_0_normal |
203 | spill_0_normal: |
204 | spill_0_normal: |
204 | SPILL_NORMAL_HANDLER_KERNEL |
205 | SPILL_NORMAL_HANDLER_KERNEL |
205 | 206 | ||
206 | /* TT = 0x84, TL = 0, spill_1_normal handler */ |
207 | /* TT = 0x84, TL = 0, spill_1_normal handler */ |
207 | .org trap_table + TT_SPILL_1_NORMAL*ENTRY_SIZE |
208 | .org trap_table + TT_SPILL_1_NORMAL*ENTRY_SIZE |
208 | .global spill_1_normal |
209 | .global spill_1_normal |
209 | spill_1_normal: |
210 | spill_1_normal: |
210 | SPILL_NORMAL_HANDLER_USERSPACE |
211 | SPILL_NORMAL_HANDLER_USERSPACE |
211 | 212 | ||
212 | /* TT = 0x88, TL = 0, spill_2_normal handler */ |
213 | /* TT = 0x88, TL = 0, spill_2_normal handler */ |
213 | .org trap_table + TT_SPILL_2_NORMAL*ENTRY_SIZE |
214 | .org trap_table + TT_SPILL_2_NORMAL*ENTRY_SIZE |
214 | .global spill_2_normal |
215 | .global spill_2_normal |
215 | spill_2_normal: |
216 | spill_2_normal: |
216 | SPILL_TO_USPACE_WINDOW_BUFFER |
217 | SPILL_TO_USPACE_WINDOW_BUFFER |
217 | 218 | ||
218 | /* TT = 0xc0, TL = 0, fill_0_normal handler */ |
219 | /* TT = 0xc0, TL = 0, fill_0_normal handler */ |
219 | .org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE |
220 | .org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE |
220 | .global fill_0_normal |
221 | .global fill_0_normal |
221 | fill_0_normal: |
222 | fill_0_normal: |
222 | FILL_NORMAL_HANDLER_KERNEL |
223 | FILL_NORMAL_HANDLER_KERNEL |
223 | 224 | ||
224 | /* TT = 0xc4, TL = 0, fill_1_normal handler */ |
225 | /* TT = 0xc4, TL = 0, fill_1_normal handler */ |
225 | .org trap_table + TT_FILL_1_NORMAL*ENTRY_SIZE |
226 | .org trap_table + TT_FILL_1_NORMAL*ENTRY_SIZE |
226 | .global fill_1_normal |
227 | .global fill_1_normal |
227 | fill_1_normal: |
228 | fill_1_normal: |
228 | FILL_NORMAL_HANDLER_USERSPACE |
229 | FILL_NORMAL_HANDLER_USERSPACE |
229 | 230 | ||
230 | /* |
231 | /* |
231 | * Handlers for TL>0. |
232 | * Handlers for TL>0. |
232 | */ |
233 | */ |
233 | 234 | ||
234 | /* TT = 0x08, TL > 0, instruction_access_exception */ |
235 | /* TT = 0x08, TL > 0, instruction_access_exception */ |
235 | .org trap_table + (TT_INSTRUCTION_ACCESS_EXCEPTION+512)*ENTRY_SIZE |
236 | .org trap_table + (TT_INSTRUCTION_ACCESS_EXCEPTION+512)*ENTRY_SIZE |
236 | .global instruction_access_exception_high |
237 | .global instruction_access_exception_high |
237 | instruction_access_exception_high: |
238 | instruction_access_exception_high: |
238 | SIMPLE_HANDLER do_instruction_access_exc |
239 | SIMPLE_HANDLER do_instruction_access_exc |
239 | 240 | ||
240 | /* TT = 0x10, TL > 0, illegal_instruction */ |
241 | /* TT = 0x10, TL > 0, illegal_instruction */ |
241 | .org trap_table + (TT_ILLEGAL_INSTRUCTION+512)*ENTRY_SIZE |
242 | .org trap_table + (TT_ILLEGAL_INSTRUCTION+512)*ENTRY_SIZE |
242 | .global illegal_instruction_high |
243 | .global illegal_instruction_high |
243 | illegal_instruction_high: |
244 | illegal_instruction_high: |
244 | SIMPLE_HANDLER do_illegal_instruction |
245 | SIMPLE_HANDLER do_illegal_instruction |
245 | 246 | ||
246 | /* TT = 0x24, TL > 0, clean_window handler */ |
247 | /* TT = 0x24, TL > 0, clean_window handler */ |
247 | .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE |
248 | .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE |
248 | .global clean_window_handler_high |
249 | .global clean_window_handler_high |
249 | clean_window_handler_high: |
250 | clean_window_handler_high: |
250 | CLEAN_WINDOW_HANDLER |
251 | CLEAN_WINDOW_HANDLER |
251 | 252 | ||
252 | /* TT = 0x32, TL > 0, data_access_error */ |
253 | /* TT = 0x32, TL > 0, data_access_error */ |
253 | .org trap_table + (TT_DATA_ACCESS_ERROR+512)*ENTRY_SIZE |
254 | .org trap_table + (TT_DATA_ACCESS_ERROR+512)*ENTRY_SIZE |
254 | .global data_access_error_high |
255 | .global data_access_error_high |
255 | data_access_error_high: |
256 | data_access_error_high: |
256 | SIMPLE_HANDLER do_data_access_error |
257 | SIMPLE_HANDLER do_data_access_error |
257 | 258 | ||
258 | /* TT = 0x34, TL > 0, mem_address_not_aligned */ |
259 | /* TT = 0x34, TL > 0, mem_address_not_aligned */ |
259 | .org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE |
260 | .org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE |
260 | .global mem_address_not_aligned_high |
261 | .global mem_address_not_aligned_high |
261 | mem_address_not_aligned_high: |
262 | mem_address_not_aligned_high: |
262 | SIMPLE_HANDLER do_mem_address_not_aligned |
263 | SIMPLE_HANDLER do_mem_address_not_aligned |
263 | 264 | ||
264 | /* TT = 0x64, TL > 0, fast_instruction_access_MMU_miss */ |
265 | /* TT = 0x64, TL > 0, fast_instruction_access_MMU_miss */ |
265 | .org trap_table + (TT_FAST_INSTRUCTION_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
266 | .org trap_table + (TT_FAST_INSTRUCTION_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
266 | .global fast_instruction_access_mmu_miss_handler_high |
267 | .global fast_instruction_access_mmu_miss_handler_high |
267 | fast_instruction_access_mmu_miss_handler_high: |
268 | fast_instruction_access_mmu_miss_handler_high: |
268 | FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER |
269 | FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER |
269 | 270 | ||
270 | /* TT = 0x68, TL > 0, fast_data_access_MMU_miss */ |
271 | /* TT = 0x68, TL > 0, fast_data_access_MMU_miss */ |
271 | .org trap_table + (TT_FAST_DATA_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
272 | .org trap_table + (TT_FAST_DATA_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
272 | .global fast_data_access_mmu_miss_handler_high |
273 | .global fast_data_access_mmu_miss_handler_high |
273 | fast_data_access_mmu_miss_handler_high: |
274 | fast_data_access_mmu_miss_handler_high: |
274 | FAST_DATA_ACCESS_MMU_MISS_HANDLER |
275 | FAST_DATA_ACCESS_MMU_MISS_HANDLER |
275 | 276 | ||
276 | /* TT = 0x6c, TL > 0, fast_data_access_protection */ |
277 | /* TT = 0x6c, TL > 0, fast_data_access_protection */ |
277 | .org trap_table + (TT_FAST_DATA_ACCESS_PROTECTION+512)*ENTRY_SIZE |
278 | .org trap_table + (TT_FAST_DATA_ACCESS_PROTECTION+512)*ENTRY_SIZE |
278 | .global fast_data_access_protection_handler_high |
279 | .global fast_data_access_protection_handler_high |
279 | fast_data_access_protection_handler_high: |
280 | fast_data_access_protection_handler_high: |
280 | FAST_DATA_ACCESS_PROTECTION_HANDLER |
281 | FAST_DATA_ACCESS_PROTECTION_HANDLER |
281 | 282 | ||
282 | /* TT = 0x80, TL > 0, spill_0_normal handler */ |
283 | /* TT = 0x80, TL > 0, spill_0_normal handler */ |
283 | .org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE |
284 | .org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE |
284 | .global spill_0_normal_high |
285 | .global spill_0_normal_high |
285 | spill_0_normal_high: |
286 | spill_0_normal_high: |
286 | SPILL_NORMAL_HANDLER_KERNEL |
287 | SPILL_NORMAL_HANDLER_KERNEL |
287 | 288 | ||
288 | /* TT = 0x88, TL > 0, spill_2_normal handler */ |
289 | /* TT = 0x88, TL > 0, spill_2_normal handler */ |
289 | .org trap_table + (TT_SPILL_2_NORMAL+512)*ENTRY_SIZE |
290 | .org trap_table + (TT_SPILL_2_NORMAL+512)*ENTRY_SIZE |
290 | .global spill_2_normal_high |
291 | .global spill_2_normal_high |
291 | spill_2_normal_high: |
292 | spill_2_normal_high: |
292 | SPILL_TO_USPACE_WINDOW_BUFFER |
293 | SPILL_TO_USPACE_WINDOW_BUFFER |
293 | 294 | ||
294 | /* TT = 0xa0, TL > 0, spill_0_other handler */ |
295 | /* TT = 0xa0, TL > 0, spill_0_other handler */ |
295 | .org trap_table + (TT_SPILL_0_OTHER+512)*ENTRY_SIZE |
296 | .org trap_table + (TT_SPILL_0_OTHER+512)*ENTRY_SIZE |
296 | .global spill_0_other_high |
297 | .global spill_0_other_high |
297 | spill_0_other_high: |
298 | spill_0_other_high: |
298 | SPILL_TO_USPACE_WINDOW_BUFFER |
299 | SPILL_TO_USPACE_WINDOW_BUFFER |
299 | 300 | ||
300 | /* TT = 0xc0, TL > 0, fill_0_normal handler */ |
301 | /* TT = 0xc0, TL > 0, fill_0_normal handler */ |
301 | .org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE |
302 | .org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE |
302 | .global fill_0_normal_high |
303 | .global fill_0_normal_high |
303 | fill_0_normal_high: |
304 | fill_0_normal_high: |
304 | FILL_NORMAL_HANDLER_KERNEL |
305 | FILL_NORMAL_HANDLER_KERNEL |
305 | 306 | ||
306 | 307 | ||
307 | /* Preemptible trap handler for TL=1. |
308 | /* Preemptible trap handler for TL=1. |
308 | * |
309 | * |
309 | * This trap handler makes arrangements to make calling of scheduler() from |
310 | * This trap handler makes arrangements to make calling of scheduler() from |
310 | * within a trap context possible. It is called from several other trap |
311 | * within a trap context possible. It is called from several other trap |
311 | * handlers. |
312 | * handlers. |
312 | * |
313 | * |
313 | * This function can be entered either with interrupt globals or alternate globals. |
314 | * This function can be entered either with interrupt globals or alternate globals. |
314 | * Memory management trap handlers are obliged to switch to one of those global sets |
315 | * Memory management trap handlers are obliged to switch to one of those global sets |
315 | * prior to calling this function. Register window management functions are not |
316 | * prior to calling this function. Register window management functions are not |
316 | * allowed to modify the alternate global registers. |
317 | * allowed to modify the alternate global registers. |
317 | * |
318 | * |
318 | * Input registers: |
319 | * Input registers: |
319 | * %g1 Address of function to call. |
320 | * %g1 Address of function to call. |
320 | * %g2 Argument for the function. |
321 | * %g2 Argument for the function. |
321 | * %g6 Pre-set as kernel stack base if trap from userspace. |
322 | * %g6 Pre-set as kernel stack base if trap from userspace. |
322 | * %g7 Pre-set as address of the userspace window buffer. |
323 | * %g7 Pre-set as address of the userspace window buffer. |
323 | */ |
324 | */ |
324 | .global preemptible_handler |
325 | .global preemptible_handler |
325 | preemptible_handler: |
326 | preemptible_handler: |
326 | rdpr %tstate, %g3 |
327 | rdpr %tstate, %g3 |
327 | andcc %g3, TSTATE_PRIV_BIT, %g0 ! if this trap came from the privileged mode... |
328 | andcc %g3, TSTATE_PRIV_BIT, %g0 ! if this trap came from the privileged mode... |
328 | bnz 0f ! ...skip setting of kernel stack and primary context |
329 | bnz 0f ! ...skip setting of kernel stack and primary context |
329 | nop |
330 | nop |
330 | 331 | ||
331 | /* |
332 | /* |
- | 333 | * Normal window spills will go to the userspace window buffer. |
|
- | 334 | */ |
|
- | 335 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(2), %wstate |
|
- | 336 | ||
- | 337 | /* |
|
332 | * Switch to kernel stack. The old stack is |
338 | * Switch to kernel stack. The old stack is |
333 | * automatically saved in the old window's %sp |
339 | * automatically saved in the old window's %sp |
334 | * and the new window's %fp. |
340 | * and the new window's %fp. |
335 | */ |
341 | */ |
336 | save %g6, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
342 | save %g6, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
337 | 343 | ||
338 | /* |
344 | /* |
339 | * Mark the CANSAVE windows as OTHER windows. |
345 | * Mark the CANSAVE windows as OTHER windows. |
340 | * Set CLEANWIN to NWINDOW-1 so that clean_window traps do not occur. |
346 | * Set CLEANWIN to NWINDOW-1 so that clean_window traps do not occur. |
341 | */ |
347 | */ |
342 | rdpr %cansave, %l0 |
348 | rdpr %cansave, %l0 |
343 | wrpr %l0, %otherwin |
349 | wrpr %l0, %otherwin |
344 | wrpr %g0, %cansave |
350 | wrpr %g0, %cansave |
345 | wrpr %g0, NWINDOW-1, %cleanwin |
351 | wrpr %g0, NWINDOW-1, %cleanwin |
346 | 352 | ||
347 | /* |
353 | /* |
348 | * Switch to primary context 0. |
354 | * Switch to primary context 0. |
349 | */ |
355 | */ |
350 | mov VA_PRIMARY_CONTEXT_REG, %l0 |
356 | mov VA_PRIMARY_CONTEXT_REG, %l0 |
351 | stxa %g0, [%l0] ASI_DMMU |
357 | stxa %g0, [%l0] ASI_DMMU |
352 | set kernel_image_start, %l0 |
358 | set kernel_image_start, %l0 |
353 | flush %l0 |
359 | flush %l0 |
354 | 360 | ||
355 | ba 1f |
361 | ba 1f |
356 | nop |
362 | nop |
357 | 363 | ||
358 | 0: |
364 | 0: |
359 | save %sp, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
365 | save %sp, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
360 | 366 | ||
361 | /* |
367 | /* |
362 | * At this moment, we are using the kernel stack |
368 | * At this moment, we are using the kernel stack |
363 | * and have successfully allocated a register window. |
369 | * and have successfully allocated a register window. |
364 | */ |
370 | */ |
365 | 1: |
371 | 1: |
366 | 372 | ||
367 | /* |
373 | /* |
- | 374 | * Other window spills will go to the userspace window buffer |
|
- | 375 | * and normal spills will go to the kernel stack. |
|
- | 376 | */ |
|
- | 377 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(0), %wstate |
|
- | 378 | ||
- | 379 | /* |
|
368 | * Copy arguments. |
380 | * Copy arguments. |
369 | */ |
381 | */ |
370 | mov %g1, %l0 |
382 | mov %g1, %l0 |
371 | mov %g2, %o0 |
383 | mov %g2, %o0 |
372 | 384 | ||
373 | /* |
385 | /* |
374 | * Save TSTATE, TPC and TNPC aside. |
386 | * Save TSTATE, TPC and TNPC aside. |
375 | */ |
387 | */ |
376 | rdpr %tstate, %g1 |
388 | rdpr %tstate, %g1 |
377 | rdpr %tpc, %g2 |
389 | rdpr %tpc, %g2 |
378 | rdpr %tnpc, %g3 |
390 | rdpr %tnpc, %g3 |
379 | 391 | ||
380 | /* |
392 | /* |
381 | * The following memory accesses will not fault |
393 | * The following memory accesses will not fault |
382 | * because special provisions are made to have |
394 | * because special provisions are made to have |
383 | * the kernel stack of THREAD locked in DTLB. |
395 | * the kernel stack of THREAD locked in DTLB. |
384 | */ |
396 | */ |
385 | stx %g1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE] |
397 | stx %g1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE] |
386 | stx %g2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC] |
398 | stx %g2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC] |
387 | stx %g3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC] |
399 | stx %g3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC] |
388 | 400 | ||
389 | wrpr %g0, 0, %tl |
401 | wrpr %g0, 0, %tl |
390 | wrpr %g0, PSTATE_PRIV_BIT, %pstate |
402 | wrpr %g0, PSTATE_PRIV_BIT, %pstate |
391 | SAVE_GLOBALS |
403 | SAVE_GLOBALS |
392 | 404 | ||
393 | /* |
405 | /* |
394 | * Call the higher-level handler and pass istate as second parameter. |
406 | * Call the higher-level handler and pass istate as second parameter. |
395 | */ |
407 | */ |
396 | call %l0 |
408 | call %l0 |
397 | add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1 |
409 | add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1 |
398 | 410 | ||
399 | RESTORE_GLOBALS |
411 | RESTORE_GLOBALS |
400 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
412 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
401 | wrpr %g0, 1, %tl |
413 | wrpr %g0, 1, %tl |
402 | 414 | ||
403 | /* |
415 | /* |
404 | * Read TSTATE, TPC and TNPC from saved copy. |
416 | * Read TSTATE, TPC and TNPC from saved copy. |
405 | */ |
417 | */ |
406 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE], %g1 |
418 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE], %g1 |
407 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC], %g2 |
419 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC], %g2 |
408 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC], %g3 |
420 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC], %g3 |
409 | 421 | ||
410 | /* |
422 | /* |
411 | * Restore TSTATE, TPC and TNPC from saved copies. |
423 | * Restore TSTATE, TPC and TNPC from saved copies. |
412 | */ |
424 | */ |
413 | wrpr %g1, 0, %tstate |
425 | wrpr %g1, 0, %tstate |
414 | wrpr %g2, 0, %tpc |
426 | wrpr %g2, 0, %tpc |
415 | wrpr %g3, 0, %tnpc |
427 | wrpr %g3, 0, %tnpc |
416 | 428 | ||
417 | /* |
429 | /* |
418 | * If OTHERWIN is zero, then all the userspace windows have been |
430 | * If OTHERWIN is zero, then all the userspace windows have been |
419 | * spilled to kernel memory (i.e. register window buffer). If |
431 | * spilled to kernel memory (i.e. register window buffer). If |
420 | * OTHERWIN is non-zero, then some userspace windows are still |
432 | * OTHERWIN is non-zero, then some userspace windows are still |
421 | * valid. Others might have been spilled. However, the CWP pointer |
433 | * valid. Others might have been spilled. However, the CWP pointer |
422 | * needs no fixing because the scheduler had not been called. |
434 | * needs no fixing because the scheduler had not been called. |
423 | */ |
435 | */ |
424 | rdpr %otherwin, %l0 |
436 | rdpr %otherwin, %l0 |
425 | brnz %l0, 0f |
437 | brnz %l0, 0f |
426 | nop |
438 | nop |
427 | 439 | ||
428 | /* |
440 | /* |
429 | * OTHERWIN == 0 |
441 | * OTHERWIN == 0 |
430 | */ |
442 | */ |
431 | 443 | ||
432 | /* |
444 | /* |
433 | * If TSTATE.CWP + 1 == CWP, then we still do not have to fix CWP. |
445 | * If TSTATE.CWP + 1 == CWP, then we still do not have to fix CWP. |
434 | */ |
446 | */ |
435 | and %g1, TSTATE_CWP_MASK, %l0 |
447 | and %g1, TSTATE_CWP_MASK, %l0 |
436 | inc %l0 |
448 | inc %l0 |
437 | and %l0, TSTATE_CWP_MASK, %l0 ! %l0 mod NWINDOW |
449 | and %l0, TSTATE_CWP_MASK, %l0 ! %l0 mod NWINDOW |
438 | rdpr %cwp, %l1 |
450 | rdpr %cwp, %l1 |
439 | cmp %l0, %l1 |
451 | cmp %l0, %l1 |
440 | bz 0f ! CWP is ok |
452 | bz 0f ! CWP is ok |
441 | nop |
453 | nop |
442 | 454 | ||
443 | /* |
455 | /* |
444 | * Fix CWP. |
456 | * Fix CWP. |
445 | * Just for reminder, the input registers in the current window |
457 | * Just for reminder, the input registers in the current window |
446 | * are the output registers of the window to which we want to |
458 | * are the output registers of the window to which we want to |
447 | * restore. Because the fill trap fills only input and local |
459 | * restore. Because the fill trap fills only input and local |
448 | * registers of a window, we need to preserve those output |
460 | * registers of a window, we need to preserve those output |
449 | * registers manually. |
461 | * registers manually. |
450 | */ |
462 | */ |
451 | flushw |
463 | flushw |
452 | mov %sp, %g1 |
464 | mov %sp, %g2 |
453 | stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0] |
465 | stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0] |
454 | stx %i1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1] |
466 | stx %i1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1] |
455 | stx %i2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2] |
467 | stx %i2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2] |
456 | stx %i3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3] |
468 | stx %i3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3] |
457 | stx %i4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4] |
469 | stx %i4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4] |
458 | stx %i5, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5] |
470 | stx %i5, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5] |
459 | stx %i6, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6] |
471 | stx %i6, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6] |
460 | stx %i7, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7] |
472 | stx %i7, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7] |
461 | wrpr %l0, 0, %cwp |
473 | wrpr %l0, 0, %cwp |
462 | mov %g1, %sp |
474 | mov %g2, %sp |
463 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0], %i0 |
475 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0], %i0 |
464 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1], %i1 |
476 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1], %i1 |
465 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2], %i2 |
477 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2], %i2 |
466 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3], %i3 |
478 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3], %i3 |
467 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4], %i4 |
479 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4], %i4 |
468 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5], %i5 |
480 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5], %i5 |
469 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6], %i6 |
481 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6], %i6 |
470 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7], %i7 |
482 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7], %i7 |
471 | 483 | ||
472 | /* |
484 | /* |
473 | * OTHERWIN != 0 or fall-through from the OTHERWIN == 0 case. |
485 | * OTHERWIN != 0 or fall-through from the OTHERWIN == 0 case. |
- | 486 | * The CWP has already been restored to the value it had prior to the SAVE |
|
- | 487 | * at the beginning of this function. |
|
- | 488 | */ |
|
- | 489 | 0: |
|
- | 490 | rdpr %tstate, %g1 |
|
- | 491 | andcc %g1, TSTATE_PRIV_BIT, %g0 ! if we are not returning to userspace..., |
|
- | 492 | bnz 1f ! ...skip restoring userspace windows |
|
- | 493 | nop |
|
- | 494 | ||
- | 495 | rdpr %cwp, %g1 |
|
- | 496 | rdpr %otherwin, %g2 |
|
- | 497 | ||
- | 498 | /* |
|
- | 499 | * Skip all OTHERWIN windows and descend to the first window |
|
- | 500 | * in the userspace window buffer. |
|
- | 501 | */ |
|
- | 502 | sub %g1, %g2, %g3 |
|
- | 503 | dec %g3 |
|
- | 504 | and %g3, NWINDOW - 1, %g3 |
|
- | 505 | wrpr %g3, 0, %cwp |
|
- | 506 | ||
- | 507 | /* |
|
- | 508 | * CWP is now in the window last saved in the userspace window buffer. |
|
- | 509 | * Fill all windows stored in the buffer. |
|
474 | */ |
510 | */ |
- | 511 | clr %g4 |
|
- | 512 | 0: andcc %g7, PAGE_WIDTH - 1, %g0 ! PAGE_SIZE alignment check |
|
- | 513 | bz 0f ! %g7 is page-aligned, no more windows to refill |
|
- | 514 | nop |
|
- | 515 | ||
- | 516 | add %g7, -STACK_WINDOW_SAVE_AREA_SIZE, %g7 |
|
- | 517 | ldx [%g7 + L0_OFFSET], %l0 |
|
- | 518 | ldx [%g7 + L1_OFFSET], %l1 |
|
- | 519 | ldx [%g7 + L2_OFFSET], %l2 |
|
- | 520 | ldx [%g7 + L3_OFFSET], %l3 |
|
- | 521 | ldx [%g7 + L4_OFFSET], %l4 |
|
- | 522 | ldx [%g7 + L5_OFFSET], %l5 |
|
- | 523 | ldx [%g7 + L6_OFFSET], %l6 |
|
- | 524 | ldx [%g7 + L7_OFFSET], %l7 |
|
- | 525 | ldx [%g7 + I0_OFFSET], %i0 |
|
- | 526 | ldx [%g7 + I1_OFFSET], %i1 |
|
- | 527 | ldx [%g7 + I2_OFFSET], %i2 |
|
- | 528 | ldx [%g7 + I3_OFFSET], %i3 |
|
- | 529 | ldx [%g7 + I4_OFFSET], %i4 |
|
- | 530 | ldx [%g7 + I5_OFFSET], %i5 |
|
- | 531 | ldx [%g7 + I6_OFFSET], %i6 |
|
- | 532 | ldx [%g7 + I7_OFFSET], %i7 |
|
- | 533 | ||
- | 534 | dec %g3 |
|
- | 535 | and %g3, NWINDOW - 1, %g3 |
|
- | 536 | wrpr %g3, 0, %cwp ! switch to the preceeding window |
|
- | 537 | ||
- | 538 | ba 0b |
|
- | 539 | inc %g4 |
|
- | 540 | ||
475 | 0: |
541 | 0: |
- | 542 | /* |
|
- | 543 | * Switch back to the proper current window and adjust |
|
- | 544 | * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN. |
|
- | 545 | */ |
|
- | 546 | wrpr %g1, 0, %cwp |
|
- | 547 | add %g4, %g2, %g2 |
|
- | 548 | mov NWINDOW - 2, %g1 |
|
- | 549 | sub %g1, %g2, %g1 |
|
- | 550 | ||
- | 551 | wrpr %g0, 0, %otherwin |
|
- | 552 | wrpr %g1, 0, %cansave ! NWINDOW - 2 - CANRESTORE |
|
476 | ! TODO: restore register windows from register window memory buffer |
553 | wrpr %g2, 0, %canrestore ! OTHERWIN + windows in the buffer |
- | 554 | wrpr %g2, 0, %cleanwin ! avoid information leak |
|
477 | 555 | ||
- | 556 | /* |
|
- | 557 | * Spills and fills will be processed by the {spill,fill}_1_normal |
|
- | 558 | * handlers. |
|
- | 559 | */ |
|
- | 560 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate |
|
- | 561 | ||
- | 562 | 1: |
|
478 | restore |
563 | restore |
479 | retry |
564 | retry |
480 | 565 | ||
481 | 566 | ||
482 |
|
567 |
|
483 | 568 | ||
484 | 569 | ||
485 | 570 |