Rev 1865 | Rev 1876 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1865 | Rev 1870 | ||
---|---|---|---|
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 | * @file |
30 | * @file |
31 | * @brief This file contains kernel trap table. |
31 | * @brief This file contains kernel trap table. |
32 | */ |
32 | */ |
33 | 33 | ||
34 | .register %g2, #scratch |
34 | .register %g2, #scratch |
35 | .register %g3, #scratch |
35 | .register %g3, #scratch |
36 | 36 | ||
37 | .text |
37 | .text |
38 | 38 | ||
39 | #include <arch/trap/trap_table.h> |
39 | #include <arch/trap/trap_table.h> |
40 | #include <arch/trap/regwin.h> |
40 | #include <arch/trap/regwin.h> |
41 | #include <arch/trap/interrupt.h> |
41 | #include <arch/trap/interrupt.h> |
42 | #include <arch/trap/exception.h> |
42 | #include <arch/trap/exception.h> |
43 | #include <arch/trap/syscall.h> |
43 | #include <arch/trap/syscall.h> |
44 | #include <arch/trap/mmu.h> |
44 | #include <arch/trap/mmu.h> |
45 | #include <arch/mm/mmu.h> |
45 | #include <arch/mm/mmu.h> |
46 | #include <arch/mm/page.h> |
46 | #include <arch/mm/page.h> |
47 | #include <arch/stack.h> |
47 | #include <arch/stack.h> |
48 | #include <arch/regdef.h> |
48 | #include <arch/regdef.h> |
49 | 49 | ||
50 | #define TABLE_SIZE TRAP_TABLE_SIZE |
50 | #define TABLE_SIZE TRAP_TABLE_SIZE |
51 | #define ENTRY_SIZE TRAP_TABLE_ENTRY_SIZE |
51 | #define ENTRY_SIZE TRAP_TABLE_ENTRY_SIZE |
52 | 52 | ||
53 | /* |
53 | /* |
54 | * Kernel trap table. |
54 | * Kernel trap table. |
55 | */ |
55 | */ |
56 | .align TABLE_SIZE |
56 | .align TABLE_SIZE |
57 | .global trap_table |
57 | .global trap_table |
58 | trap_table: |
58 | trap_table: |
59 | 59 | ||
60 | /* TT = 0x08, TL = 0, instruction_access_exception */ |
60 | /* TT = 0x08, TL = 0, instruction_access_exception */ |
61 | .org trap_table + TT_INSTRUCTION_ACCESS_EXCEPTION*ENTRY_SIZE |
61 | .org trap_table + TT_INSTRUCTION_ACCESS_EXCEPTION*ENTRY_SIZE |
62 | .global instruction_access_exception |
62 | .global instruction_access_exception_tl0 |
63 | instruction_access_exception: |
63 | instruction_access_exception_tl0: |
- | 64 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
|
- | 65 | PREEMPTIBLE_HANDLER instruction_access_exception |
|
- | 66 | ||
- | 67 | /* TT = 0x0a, TL = 0, instruction_access_error */ |
|
- | 68 | .org trap_table + TT_INSTRUCTION_ACCESS_ERROR*ENTRY_SIZE |
|
- | 69 | .global instruction_access_error_tl0 |
|
- | 70 | instruction_access_error_tl0: |
|
64 | PREEMPTIBLE_HANDLER do_instruction_access_exc |
71 | PREEMPTIBLE_HANDLER instruction_access_error |
65 | 72 | ||
66 | /* TT = 0x10, TL = 0, illegal_instruction */ |
73 | /* TT = 0x10, TL = 0, illegal_instruction */ |
67 | .org trap_table + TT_ILLEGAL_INSTRUCTION*ENTRY_SIZE |
74 | .org trap_table + TT_ILLEGAL_INSTRUCTION*ENTRY_SIZE |
68 | .global illegal_instruction |
75 | .global illegal_instruction_tl0 |
69 | illegal_instruction: |
76 | illegal_instruction_tl0: |
70 | PREEMPTIBLE_HANDLER do_illegal_instruction |
77 | PREEMPTIBLE_HANDLER illegal_instruction |
- | 78 | ||
- | 79 | /* TT = 0x11, TL = 0, privileged_opcode */ |
|
- | 80 | .org trap_table + TT_PRIVILEGED_OPCODE*ENTRY_SIZE |
|
- | 81 | .global privileged_opcode_tl0 |
|
- | 82 | privileged_opcode_tl0: |
|
- | 83 | PREEMPTIBLE_HANDLER privileged_opcode |
|
71 | 84 | ||
72 | /* TT = 0x24, TL = 0, clean_window handler */ |
85 | /* TT = 0x24, TL = 0, clean_window handler */ |
73 | .org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE |
86 | .org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE |
74 | .global clean_window_handler |
87 | .global clean_window_handler_tl0 |
75 | clean_window_handler: |
88 | clean_window_handler_tl0: |
76 | CLEAN_WINDOW_HANDLER |
89 | CLEAN_WINDOW_HANDLER |
77 | 90 | ||
- | 91 | /* TT = 0x28, TL = 0, division_by_zero */ |
|
- | 92 | .org trap_table + TT_DIVISION_BY_ZERO*ENTRY_SIZE |
|
- | 93 | .global division_by_zero_tl0 |
|
- | 94 | division_by_zero_tl0: |
|
- | 95 | PREEMPTIBLE_HANDLER division_by_zero |
|
- | 96 | ||
- | 97 | /* TT = 0x30, TL = 0, data_access_exception */ |
|
- | 98 | .org trap_table + TT_DATA_ACCESS_EXCEPTION*ENTRY_SIZE |
|
- | 99 | .global data_access_exception_tl0 |
|
- | 100 | data_access_exception_tl0: |
|
- | 101 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
|
- | 102 | PREEMPTIBLE_HANDLER data_access_exception |
|
- | 103 | ||
78 | /* TT = 0x32, TL = 0, data_access_error */ |
104 | /* TT = 0x32, TL = 0, data_access_error */ |
79 | .org trap_table + TT_DATA_ACCESS_ERROR*ENTRY_SIZE |
105 | .org trap_table + TT_DATA_ACCESS_ERROR*ENTRY_SIZE |
80 | .global data_access_error |
106 | .global data_access_error_tl0 |
81 | data_access_error: |
107 | data_access_error_tl0: |
82 | PREEMPTIBLE_HANDLER do_data_access_error |
108 | PREEMPTIBLE_HANDLER data_access_error |
83 | 109 | ||
84 | /* TT = 0x34, TL = 0, mem_address_not_aligned */ |
110 | /* TT = 0x34, TL = 0, mem_address_not_aligned */ |
85 | .org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE |
111 | .org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE |
86 | .global mem_address_not_aligned |
112 | .global mem_address_not_aligned_tl0 |
87 | mem_address_not_aligned: |
113 | mem_address_not_aligned_tl0: |
88 | MEM_ADDRESS_NOT_ALIGNED_HANDLER |
114 | PREEMPTIBLE_HANDLER mem_address_not_aligned |
- | 115 | ||
- | 116 | /* TT = 0x38, TL = 0, privileged_action */ |
|
- | 117 | .org trap_table + TT_PRIVILEGED_ACTION*ENTRY_SIZE |
|
- | 118 | .global privileged_action_tl0 |
|
- | 119 | privileged_action_tl0: |
|
- | 120 | PREEMPTIBLE_HANDLER privileged_action |
|
89 | 121 | ||
90 | /* TT = 0x41, TL = 0, interrupt_level_1 handler */ |
122 | /* TT = 0x41, TL = 0, interrupt_level_1 handler */ |
91 | .org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE |
123 | .org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE |
92 | .global interrupt_level_1_handler |
124 | .global interrupt_level_1_handler_tl0 |
93 | interrupt_level_1_handler: |
125 | interrupt_level_1_handler_tl0: |
94 | INTERRUPT_LEVEL_N_HANDLER 1 |
126 | INTERRUPT_LEVEL_N_HANDLER 1 |
95 | 127 | ||
96 | /* TT = 0x42, TL = 0, interrupt_level_2 handler */ |
128 | /* TT = 0x42, TL = 0, interrupt_level_2 handler */ |
97 | .org trap_table + TT_INTERRUPT_LEVEL_2*ENTRY_SIZE |
129 | .org trap_table + TT_INTERRUPT_LEVEL_2*ENTRY_SIZE |
98 | .global interrupt_level_2_handler |
130 | .global interrupt_level_2_handler_tl0 |
99 | interrupt_level_2_handler: |
131 | interrupt_level_2_handler_tl0: |
100 | INTERRUPT_LEVEL_N_HANDLER 2 |
132 | INTERRUPT_LEVEL_N_HANDLER 2 |
101 | 133 | ||
102 | /* TT = 0x43, TL = 0, interrupt_level_3 handler */ |
134 | /* TT = 0x43, TL = 0, interrupt_level_3 handler */ |
103 | .org trap_table + TT_INTERRUPT_LEVEL_3*ENTRY_SIZE |
135 | .org trap_table + TT_INTERRUPT_LEVEL_3*ENTRY_SIZE |
104 | .global interrupt_level_3_handler |
136 | .global interrupt_level_3_handler_tl0 |
105 | interrupt_level_3_handler: |
137 | interrupt_level_3_handler_tl0: |
106 | INTERRUPT_LEVEL_N_HANDLER 3 |
138 | INTERRUPT_LEVEL_N_HANDLER 3 |
107 | 139 | ||
108 | /* TT = 0x44, TL = 0, interrupt_level_4 handler */ |
140 | /* TT = 0x44, TL = 0, interrupt_level_4 handler */ |
109 | .org trap_table + TT_INTERRUPT_LEVEL_4*ENTRY_SIZE |
141 | .org trap_table + TT_INTERRUPT_LEVEL_4*ENTRY_SIZE |
110 | .global interrupt_level_4_handler |
142 | .global interrupt_level_4_handler_tl0 |
111 | interrupt_level_4_handler: |
143 | interrupt_level_4_handler_tl0: |
112 | INTERRUPT_LEVEL_N_HANDLER 4 |
144 | INTERRUPT_LEVEL_N_HANDLER 4 |
113 | 145 | ||
114 | /* TT = 0x45, TL = 0, interrupt_level_5 handler */ |
146 | /* TT = 0x45, TL = 0, interrupt_level_5 handler */ |
115 | .org trap_table + TT_INTERRUPT_LEVEL_5*ENTRY_SIZE |
147 | .org trap_table + TT_INTERRUPT_LEVEL_5*ENTRY_SIZE |
116 | .global interrupt_level_5_handler |
148 | .global interrupt_level_5_handler_tl0 |
117 | interrupt_level_5_handler: |
149 | interrupt_level_5_handler_tl0: |
118 | INTERRUPT_LEVEL_N_HANDLER 5 |
150 | INTERRUPT_LEVEL_N_HANDLER 5 |
119 | 151 | ||
120 | /* TT = 0x46, TL = 0, interrupt_level_6 handler */ |
152 | /* TT = 0x46, TL = 0, interrupt_level_6 handler */ |
121 | .org trap_table + TT_INTERRUPT_LEVEL_6*ENTRY_SIZE |
153 | .org trap_table + TT_INTERRUPT_LEVEL_6*ENTRY_SIZE |
122 | .global interrupt_level_6_handler |
154 | .global interrupt_level_6_handler_tl0 |
123 | interrupt_level_6_handler: |
155 | interrupt_level_6_handler_tl0: |
124 | INTERRUPT_LEVEL_N_HANDLER 6 |
156 | INTERRUPT_LEVEL_N_HANDLER 6 |
125 | 157 | ||
126 | /* TT = 0x47, TL = 0, interrupt_level_7 handler */ |
158 | /* TT = 0x47, TL = 0, interrupt_level_7 handler */ |
127 | .org trap_table + TT_INTERRUPT_LEVEL_7*ENTRY_SIZE |
159 | .org trap_table + TT_INTERRUPT_LEVEL_7*ENTRY_SIZE |
128 | .global interrupt_level_7_handler |
160 | .global interrupt_level_7_handler_tl0 |
129 | interrupt_level_7_handler: |
161 | interrupt_level_7_handler_tl0: |
130 | INTERRUPT_LEVEL_N_HANDLER 7 |
162 | INTERRUPT_LEVEL_N_HANDLER 7 |
131 | 163 | ||
132 | /* TT = 0x48, TL = 0, interrupt_level_8 handler */ |
164 | /* TT = 0x48, TL = 0, interrupt_level_8 handler */ |
133 | .org trap_table + TT_INTERRUPT_LEVEL_8*ENTRY_SIZE |
165 | .org trap_table + TT_INTERRUPT_LEVEL_8*ENTRY_SIZE |
134 | .global interrupt_level_8_handler |
166 | .global interrupt_level_8_handler_tl0 |
135 | interrupt_level_8_handler: |
167 | interrupt_level_8_handler_tl0: |
136 | INTERRUPT_LEVEL_N_HANDLER 8 |
168 | INTERRUPT_LEVEL_N_HANDLER 8 |
137 | 169 | ||
138 | /* TT = 0x49, TL = 0, interrupt_level_9 handler */ |
170 | /* TT = 0x49, TL = 0, interrupt_level_9 handler */ |
139 | .org trap_table + TT_INTERRUPT_LEVEL_9*ENTRY_SIZE |
171 | .org trap_table + TT_INTERRUPT_LEVEL_9*ENTRY_SIZE |
140 | .global interrupt_level_9_handler |
172 | .global interrupt_level_9_handler_tl0 |
141 | interrupt_level_9_handler: |
173 | interrupt_level_9_handler_tl0: |
142 | INTERRUPT_LEVEL_N_HANDLER 9 |
174 | INTERRUPT_LEVEL_N_HANDLER 9 |
143 | 175 | ||
144 | /* TT = 0x4a, TL = 0, interrupt_level_10 handler */ |
176 | /* TT = 0x4a, TL = 0, interrupt_level_10 handler */ |
145 | .org trap_table + TT_INTERRUPT_LEVEL_10*ENTRY_SIZE |
177 | .org trap_table + TT_INTERRUPT_LEVEL_10*ENTRY_SIZE |
146 | .global interrupt_level_10_handler |
178 | .global interrupt_level_10_handler_tl0 |
147 | interrupt_level_10_handler: |
179 | interrupt_level_10_handler_tl0: |
148 | INTERRUPT_LEVEL_N_HANDLER 10 |
180 | INTERRUPT_LEVEL_N_HANDLER 10 |
149 | 181 | ||
150 | /* TT = 0x4b, TL = 0, interrupt_level_11 handler */ |
182 | /* TT = 0x4b, TL = 0, interrupt_level_11 handler */ |
151 | .org trap_table + TT_INTERRUPT_LEVEL_11*ENTRY_SIZE |
183 | .org trap_table + TT_INTERRUPT_LEVEL_11*ENTRY_SIZE |
152 | .global interrupt_level_11_handler |
184 | .global interrupt_level_11_handler_tl0 |
153 | interrupt_level_11_handler: |
185 | interrupt_level_11_handler_tl0: |
154 | INTERRUPT_LEVEL_N_HANDLER 11 |
186 | INTERRUPT_LEVEL_N_HANDLER 11 |
155 | 187 | ||
156 | /* TT = 0x4c, TL = 0, interrupt_level_12 handler */ |
188 | /* TT = 0x4c, TL = 0, interrupt_level_12 handler */ |
157 | .org trap_table + TT_INTERRUPT_LEVEL_12*ENTRY_SIZE |
189 | .org trap_table + TT_INTERRUPT_LEVEL_12*ENTRY_SIZE |
158 | .global interrupt_level_12_handler |
190 | .global interrupt_level_12_handler_tl0 |
159 | interrupt_level_12_handler: |
191 | interrupt_level_12_handler_tl0: |
160 | INTERRUPT_LEVEL_N_HANDLER 12 |
192 | INTERRUPT_LEVEL_N_HANDLER 12 |
161 | 193 | ||
162 | /* TT = 0x4d, TL = 0, interrupt_level_13 handler */ |
194 | /* TT = 0x4d, TL = 0, interrupt_level_13 handler */ |
163 | .org trap_table + TT_INTERRUPT_LEVEL_13*ENTRY_SIZE |
195 | .org trap_table + TT_INTERRUPT_LEVEL_13*ENTRY_SIZE |
164 | .global interrupt_level_13_handler |
196 | .global interrupt_level_13_handler_tl0 |
165 | interrupt_level_13_handler: |
197 | interrupt_level_13_handler_tl0: |
166 | INTERRUPT_LEVEL_N_HANDLER 13 |
198 | INTERRUPT_LEVEL_N_HANDLER 13 |
167 | 199 | ||
168 | /* TT = 0x4e, TL = 0, interrupt_level_14 handler */ |
200 | /* TT = 0x4e, TL = 0, interrupt_level_14 handler */ |
169 | .org trap_table + TT_INTERRUPT_LEVEL_14*ENTRY_SIZE |
201 | .org trap_table + TT_INTERRUPT_LEVEL_14*ENTRY_SIZE |
170 | .global interrupt_level_14_handler |
202 | .global interrupt_level_14_handler_tl0 |
171 | interrupt_level_14_handler: |
203 | interrupt_level_14_handler_tl0: |
172 | INTERRUPT_LEVEL_N_HANDLER 14 |
204 | INTERRUPT_LEVEL_N_HANDLER 14 |
173 | 205 | ||
174 | /* TT = 0x4f, TL = 0, interrupt_level_15 handler */ |
206 | /* TT = 0x4f, TL = 0, interrupt_level_15 handler */ |
175 | .org trap_table + TT_INTERRUPT_LEVEL_15*ENTRY_SIZE |
207 | .org trap_table + TT_INTERRUPT_LEVEL_15*ENTRY_SIZE |
176 | .global interrupt_level_15_handler |
208 | .global interrupt_level_15_handler_tl0 |
177 | interrupt_level_15_handler: |
209 | interrupt_level_15_handler_tl0: |
178 | INTERRUPT_LEVEL_N_HANDLER 15 |
210 | INTERRUPT_LEVEL_N_HANDLER 15 |
179 | 211 | ||
180 | /* TT = 0x60, TL = 0, interrupt_vector_trap handler */ |
212 | /* TT = 0x60, TL = 0, interrupt_vector_trap handler */ |
181 | .org trap_table + TT_INTERRUPT_VECTOR_TRAP*ENTRY_SIZE |
213 | .org trap_table + TT_INTERRUPT_VECTOR_TRAP*ENTRY_SIZE |
182 | .global interrupt_vector_trap_handler |
214 | .global interrupt_vector_trap_handler_tl0 |
183 | interrupt_vector_trap_handler: |
215 | interrupt_vector_trap_handler_tl0: |
184 | INTERRUPT_VECTOR_TRAP_HANDLER |
216 | INTERRUPT_VECTOR_TRAP_HANDLER |
185 | 217 | ||
186 | /* TT = 0x64, TL = 0, fast_instruction_access_MMU_miss */ |
218 | /* TT = 0x64, TL = 0, fast_instruction_access_MMU_miss */ |
187 | .org trap_table + TT_FAST_INSTRUCTION_ACCESS_MMU_MISS*ENTRY_SIZE |
219 | .org trap_table + TT_FAST_INSTRUCTION_ACCESS_MMU_MISS*ENTRY_SIZE |
188 | .global fast_instruction_access_mmu_miss_handler |
220 | .global fast_instruction_access_mmu_miss_handler_tl0 |
189 | fast_instruction_access_mmu_miss_handler: |
221 | fast_instruction_access_mmu_miss_handler_tl0: |
190 | FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER |
222 | FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER |
191 | 223 | ||
192 | /* TT = 0x68, TL = 0, fast_data_access_MMU_miss */ |
224 | /* TT = 0x68, TL = 0, fast_data_access_MMU_miss */ |
193 | .org trap_table + TT_FAST_DATA_ACCESS_MMU_MISS*ENTRY_SIZE |
225 | .org trap_table + TT_FAST_DATA_ACCESS_MMU_MISS*ENTRY_SIZE |
194 | .global fast_data_access_mmu_miss_handler |
226 | .global fast_data_access_mmu_miss_handler_tl0 |
195 | fast_data_access_mmu_miss_handler: |
227 | fast_data_access_mmu_miss_handler_tl0: |
196 | FAST_DATA_ACCESS_MMU_MISS_HANDLER |
228 | FAST_DATA_ACCESS_MMU_MISS_HANDLER 0 |
197 | 229 | ||
198 | /* TT = 0x6c, TL = 0, fast_data_access_protection */ |
230 | /* TT = 0x6c, TL = 0, fast_data_access_protection */ |
199 | .org trap_table + TT_FAST_DATA_ACCESS_PROTECTION*ENTRY_SIZE |
231 | .org trap_table + TT_FAST_DATA_ACCESS_PROTECTION*ENTRY_SIZE |
200 | .global fast_data_access_protection_handler |
232 | .global fast_data_access_protection_handler_tl0 |
201 | fast_data_access_protection_handler: |
233 | fast_data_access_protection_handler_tl0: |
202 | FAST_DATA_ACCESS_PROTECTION_HANDLER |
234 | FAST_DATA_ACCESS_PROTECTION_HANDLER 0 |
203 | 235 | ||
204 | /* TT = 0x80, TL = 0, spill_0_normal handler */ |
236 | /* TT = 0x80, TL = 0, spill_0_normal handler */ |
205 | .org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE |
237 | .org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE |
206 | .global spill_0_normal |
238 | .global spill_0_normal_tl0 |
207 | spill_0_normal: |
239 | spill_0_normal_tl0: |
208 | SPILL_NORMAL_HANDLER_KERNEL |
240 | SPILL_NORMAL_HANDLER_KERNEL |
209 | 241 | ||
210 | /* TT = 0x84, TL = 0, spill_1_normal handler */ |
242 | /* TT = 0x84, TL = 0, spill_1_normal handler */ |
211 | .org trap_table + TT_SPILL_1_NORMAL*ENTRY_SIZE |
243 | .org trap_table + TT_SPILL_1_NORMAL*ENTRY_SIZE |
212 | .global spill_1_normal |
244 | .global spill_1_normal_tl0 |
213 | spill_1_normal: |
245 | spill_1_normal_tl0: |
214 | SPILL_NORMAL_HANDLER_USERSPACE |
246 | SPILL_NORMAL_HANDLER_USERSPACE |
215 | 247 | ||
216 | /* TT = 0x88, TL = 0, spill_2_normal handler */ |
248 | /* TT = 0x88, TL = 0, spill_2_normal handler */ |
217 | .org trap_table + TT_SPILL_2_NORMAL*ENTRY_SIZE |
249 | .org trap_table + TT_SPILL_2_NORMAL*ENTRY_SIZE |
218 | .global spill_2_normal |
250 | .global spill_2_normal_tl0 |
219 | spill_2_normal: |
251 | spill_2_normal_tl0: |
220 | SPILL_TO_USPACE_WINDOW_BUFFER |
252 | SPILL_TO_USPACE_WINDOW_BUFFER |
221 | 253 | ||
222 | /* TT = 0xa0, TL = 0, spill_0_other handler */ |
254 | /* TT = 0xa0, TL = 0, spill_0_other handler */ |
223 | .org trap_table + TT_SPILL_0_OTHER*ENTRY_SIZE |
255 | .org trap_table + TT_SPILL_0_OTHER*ENTRY_SIZE |
224 | .global spill_0_other |
256 | .global spill_0_other_tl0 |
225 | spill_0_other: |
257 | spill_0_other_tl0: |
226 | SPILL_TO_USPACE_WINDOW_BUFFER |
258 | SPILL_TO_USPACE_WINDOW_BUFFER |
227 | 259 | ||
228 | /* TT = 0xc0, TL = 0, fill_0_normal handler */ |
260 | /* TT = 0xc0, TL = 0, fill_0_normal handler */ |
229 | .org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE |
261 | .org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE |
230 | .global fill_0_normal |
262 | .global fill_0_normal_tl0 |
231 | fill_0_normal: |
263 | fill_0_normal_tl0: |
232 | FILL_NORMAL_HANDLER_KERNEL |
264 | FILL_NORMAL_HANDLER_KERNEL |
233 | 265 | ||
234 | /* TT = 0xc4, TL = 0, fill_1_normal handler */ |
266 | /* TT = 0xc4, TL = 0, fill_1_normal handler */ |
235 | .org trap_table + TT_FILL_1_NORMAL*ENTRY_SIZE |
267 | .org trap_table + TT_FILL_1_NORMAL*ENTRY_SIZE |
236 | .global fill_1_normal |
268 | .global fill_1_normal_tl0 |
237 | fill_1_normal: |
269 | fill_1_normal_tl0: |
238 | FILL_NORMAL_HANDLER_USERSPACE |
270 | FILL_NORMAL_HANDLER_USERSPACE |
239 | 271 | ||
240 | /* TT = 0x100, TL = 0, trap_instruction_0 */ |
272 | /* TT = 0x100, TL = 0, trap_instruction_0 */ |
241 | .org trap_table + TT_TRAP_INSTRUCTION(0)*ENTRY_SIZE |
273 | .org trap_table + TT_TRAP_INSTRUCTION(0)*ENTRY_SIZE |
242 | .global trap_instruction_0 |
274 | .global trap_instruction_0_tl0 |
243 | trap_instruction_0: |
275 | trap_instruction_0_tl0: |
244 | TRAP_INSTRUCTION 0 |
276 | TRAP_INSTRUCTION 0 |
245 | 277 | ||
246 | /* TT = 0x101, TL = 0, trap_instruction_1 */ |
278 | /* TT = 0x101, TL = 0, trap_instruction_1 */ |
247 | .org trap_table + TT_TRAP_INSTRUCTION(1)*ENTRY_SIZE |
279 | .org trap_table + TT_TRAP_INSTRUCTION(1)*ENTRY_SIZE |
248 | .global trap_instruction_1 |
280 | .global trap_instruction_1_tl0 |
249 | trap_instruction_1: |
281 | trap_instruction_1_tl0: |
250 | TRAP_INSTRUCTION 1 |
282 | TRAP_INSTRUCTION 1 |
251 | 283 | ||
252 | /* TT = 0x102, TL = 0, trap_instruction_2 */ |
284 | /* TT = 0x102, TL = 0, trap_instruction_2 */ |
253 | .org trap_table + TT_TRAP_INSTRUCTION(2)*ENTRY_SIZE |
285 | .org trap_table + TT_TRAP_INSTRUCTION(2)*ENTRY_SIZE |
254 | .global trap_instruction_2 |
286 | .global trap_instruction_2_tl0 |
255 | trap_instruction_2: |
287 | trap_instruction_2_tl0: |
256 | TRAP_INSTRUCTION 2 |
288 | TRAP_INSTRUCTION 2 |
257 | 289 | ||
258 | /* TT = 0x103, TL = 0, trap_instruction_3 */ |
290 | /* TT = 0x103, TL = 0, trap_instruction_3 */ |
259 | .org trap_table + TT_TRAP_INSTRUCTION(3)*ENTRY_SIZE |
291 | .org trap_table + TT_TRAP_INSTRUCTION(3)*ENTRY_SIZE |
260 | .global trap_instruction_3 |
292 | .global trap_instruction_3_tl0 |
261 | trap_instruction_3: |
293 | trap_instruction_3_tl0: |
262 | TRAP_INSTRUCTION 3 |
294 | TRAP_INSTRUCTION 3 |
263 | 295 | ||
264 | /* TT = 0x104, TL = 0, trap_instruction_4 */ |
296 | /* TT = 0x104, TL = 0, trap_instruction_4 */ |
265 | .org trap_table + TT_TRAP_INSTRUCTION(4)*ENTRY_SIZE |
297 | .org trap_table + TT_TRAP_INSTRUCTION(4)*ENTRY_SIZE |
266 | .global trap_instruction_4 |
298 | .global trap_instruction_4_tl0 |
267 | trap_instruction_4: |
299 | trap_instruction_4_tl0: |
268 | TRAP_INSTRUCTION 4 |
300 | TRAP_INSTRUCTION 4 |
269 | 301 | ||
270 | /* TT = 0x105, TL = 0, trap_instruction_5 */ |
302 | /* TT = 0x105, TL = 0, trap_instruction_5 */ |
271 | .org trap_table + TT_TRAP_INSTRUCTION(5)*ENTRY_SIZE |
303 | .org trap_table + TT_TRAP_INSTRUCTION(5)*ENTRY_SIZE |
272 | .global trap_instruction_5 |
304 | .global trap_instruction_5_tl0 |
273 | trap_instruction_5: |
305 | trap_instruction_5_tl0: |
274 | TRAP_INSTRUCTION 5 |
306 | TRAP_INSTRUCTION 5 |
275 | 307 | ||
276 | /* TT = 0x106, TL = 0, trap_instruction_6 */ |
308 | /* TT = 0x106, TL = 0, trap_instruction_6 */ |
277 | .org trap_table + TT_TRAP_INSTRUCTION(6)*ENTRY_SIZE |
309 | .org trap_table + TT_TRAP_INSTRUCTION(6)*ENTRY_SIZE |
278 | .global trap_instruction_6 |
310 | .global trap_instruction_6_tl0 |
279 | trap_instruction_6: |
311 | trap_instruction_6_tl0: |
280 | TRAP_INSTRUCTION 6 |
312 | TRAP_INSTRUCTION 6 |
281 | 313 | ||
282 | /* TT = 0x107, TL = 0, trap_instruction_7 */ |
314 | /* TT = 0x107, TL = 0, trap_instruction_7 */ |
283 | .org trap_table + TT_TRAP_INSTRUCTION(7)*ENTRY_SIZE |
315 | .org trap_table + TT_TRAP_INSTRUCTION(7)*ENTRY_SIZE |
284 | .global trap_instruction_7 |
316 | .global trap_instruction_7_tl0 |
285 | trap_instruction_7: |
317 | trap_instruction_7_tl0: |
286 | TRAP_INSTRUCTION 7 |
318 | TRAP_INSTRUCTION 7 |
287 | 319 | ||
288 | /* TT = 0x108, TL = 0, trap_instruction_8 */ |
320 | /* TT = 0x108, TL = 0, trap_instruction_8 */ |
289 | .org trap_table + TT_TRAP_INSTRUCTION(8)*ENTRY_SIZE |
321 | .org trap_table + TT_TRAP_INSTRUCTION(8)*ENTRY_SIZE |
290 | .global trap_instruction_8 |
322 | .global trap_instruction_8_tl0 |
291 | trap_instruction_8: |
323 | trap_instruction_8_tl0: |
292 | TRAP_INSTRUCTION 8 |
324 | TRAP_INSTRUCTION 8 |
293 | 325 | ||
294 | /* TT = 0x109, TL = 0, trap_instruction_9 */ |
326 | /* TT = 0x109, TL = 0, trap_instruction_9 */ |
295 | .org trap_table + TT_TRAP_INSTRUCTION(9)*ENTRY_SIZE |
327 | .org trap_table + TT_TRAP_INSTRUCTION(9)*ENTRY_SIZE |
296 | .global trap_instruction_9 |
328 | .global trap_instruction_9_tl0 |
297 | trap_instruction_9: |
329 | trap_instruction_9_tl0: |
298 | TRAP_INSTRUCTION 9 |
330 | TRAP_INSTRUCTION 9 |
299 | 331 | ||
300 | /* TT = 0x10a, TL = 0, trap_instruction_10 */ |
332 | /* TT = 0x10a, TL = 0, trap_instruction_10 */ |
301 | .org trap_table + TT_TRAP_INSTRUCTION(10)*ENTRY_SIZE |
333 | .org trap_table + TT_TRAP_INSTRUCTION(10)*ENTRY_SIZE |
302 | .global trap_instruction_10 |
334 | .global trap_instruction_10_tl0 |
303 | trap_instruction_10: |
335 | trap_instruction_10_tl0: |
304 | TRAP_INSTRUCTION 10 |
336 | TRAP_INSTRUCTION 10 |
305 | 337 | ||
306 | /* TT = 0x10b, TL = 0, trap_instruction_11 */ |
338 | /* TT = 0x10b, TL = 0, trap_instruction_11 */ |
307 | .org trap_table + TT_TRAP_INSTRUCTION(11)*ENTRY_SIZE |
339 | .org trap_table + TT_TRAP_INSTRUCTION(11)*ENTRY_SIZE |
308 | .global trap_instruction_11 |
340 | .global trap_instruction_11_tl0 |
309 | trap_instruction_11: |
341 | trap_instruction_11_tl0: |
310 | TRAP_INSTRUCTION 11 |
342 | TRAP_INSTRUCTION 11 |
311 | 343 | ||
312 | /* TT = 0x10c, TL = 0, trap_instruction_12 */ |
344 | /* TT = 0x10c, TL = 0, trap_instruction_12 */ |
313 | .org trap_table + TT_TRAP_INSTRUCTION(12)*ENTRY_SIZE |
345 | .org trap_table + TT_TRAP_INSTRUCTION(12)*ENTRY_SIZE |
314 | .global trap_instruction_12 |
346 | .global trap_instruction_12_tl0 |
315 | trap_instruction_12: |
347 | trap_instruction_12_tl0: |
316 | TRAP_INSTRUCTION 12 |
348 | TRAP_INSTRUCTION 12 |
317 | 349 | ||
318 | /* TT = 0x10d, TL = 0, trap_instruction_13 */ |
350 | /* TT = 0x10d, TL = 0, trap_instruction_13 */ |
319 | .org trap_table + TT_TRAP_INSTRUCTION(13)*ENTRY_SIZE |
351 | .org trap_table + TT_TRAP_INSTRUCTION(13)*ENTRY_SIZE |
320 | .global trap_instruction_13 |
352 | .global trap_instruction_13_tl0 |
321 | trap_instruction_13: |
353 | trap_instruction_13_tl0: |
322 | TRAP_INSTRUCTION 13 |
354 | TRAP_INSTRUCTION 13 |
323 | 355 | ||
324 | /* TT = 0x10e, TL = 0, trap_instruction_14 */ |
356 | /* TT = 0x10e, TL = 0, trap_instruction_14 */ |
325 | .org trap_table + TT_TRAP_INSTRUCTION(14)*ENTRY_SIZE |
357 | .org trap_table + TT_TRAP_INSTRUCTION(14)*ENTRY_SIZE |
326 | .global trap_instruction_14 |
358 | .global trap_instruction_14_tl0 |
327 | trap_instruction_14: |
359 | trap_instruction_14_tl0: |
328 | TRAP_INSTRUCTION 14 |
360 | TRAP_INSTRUCTION 14 |
329 | 361 | ||
330 | /* TT = 0x10f, TL = 0, trap_instruction_15 */ |
362 | /* TT = 0x10f, TL = 0, trap_instruction_15 */ |
331 | .org trap_table + TT_TRAP_INSTRUCTION(15)*ENTRY_SIZE |
363 | .org trap_table + TT_TRAP_INSTRUCTION(15)*ENTRY_SIZE |
332 | .global trap_instruction_15 |
364 | .global trap_instruction_15_tl0 |
333 | trap_instruction_15: |
365 | trap_instruction_15_tl0: |
334 | TRAP_INSTRUCTION 15 |
366 | TRAP_INSTRUCTION 15 |
335 | 367 | ||
336 | /* TT = 0x110, TL = 0, trap_instruction_16 */ |
368 | /* TT = 0x110, TL = 0, trap_instruction_16 */ |
337 | .org trap_table + TT_TRAP_INSTRUCTION(16)*ENTRY_SIZE |
369 | .org trap_table + TT_TRAP_INSTRUCTION(16)*ENTRY_SIZE |
338 | .global trap_instruction_16 |
370 | .global trap_instruction_16_tl0 |
339 | trap_instruction_16: |
371 | trap_instruction_16_tl0: |
340 | TRAP_INSTRUCTION 16 |
372 | TRAP_INSTRUCTION 16 |
341 | 373 | ||
342 | /* TT = 0x111, TL = 0, trap_instruction_17 */ |
374 | /* TT = 0x111, TL = 0, trap_instruction_17 */ |
343 | .org trap_table + TT_TRAP_INSTRUCTION(17)*ENTRY_SIZE |
375 | .org trap_table + TT_TRAP_INSTRUCTION(17)*ENTRY_SIZE |
344 | .global trap_instruction_17 |
376 | .global trap_instruction_17_tl0 |
345 | trap_instruction_17: |
377 | trap_instruction_17_tl0: |
346 | TRAP_INSTRUCTION 17 |
378 | TRAP_INSTRUCTION 17 |
347 | 379 | ||
348 | /* TT = 0x112, TL = 0, trap_instruction_18 */ |
380 | /* TT = 0x112, TL = 0, trap_instruction_18 */ |
349 | .org trap_table + TT_TRAP_INSTRUCTION(18)*ENTRY_SIZE |
381 | .org trap_table + TT_TRAP_INSTRUCTION(18)*ENTRY_SIZE |
350 | .global trap_instruction_18 |
382 | .global trap_instruction_18_tl0 |
351 | trap_instruction_18: |
383 | trap_instruction_18_tl0: |
352 | TRAP_INSTRUCTION 18 |
384 | TRAP_INSTRUCTION 18 |
353 | 385 | ||
354 | /* TT = 0x113, TL = 0, trap_instruction_19 */ |
386 | /* TT = 0x113, TL = 0, trap_instruction_19 */ |
355 | .org trap_table + TT_TRAP_INSTRUCTION(19)*ENTRY_SIZE |
387 | .org trap_table + TT_TRAP_INSTRUCTION(19)*ENTRY_SIZE |
356 | .global trap_instruction_19 |
388 | .global trap_instruction_19_tl0 |
357 | trap_instruction_19: |
389 | trap_instruction_19_tl0: |
358 | TRAP_INSTRUCTION 19 |
390 | TRAP_INSTRUCTION 19 |
359 | 391 | ||
360 | /* TT = 0x114, TL = 0, trap_instruction_20 */ |
392 | /* TT = 0x114, TL = 0, trap_instruction_20 */ |
361 | .org trap_table + TT_TRAP_INSTRUCTION(20)*ENTRY_SIZE |
393 | .org trap_table + TT_TRAP_INSTRUCTION(20)*ENTRY_SIZE |
362 | .global trap_instruction_20 |
394 | .global trap_instruction_20_tl0 |
363 | trap_instruction_20: |
395 | trap_instruction_20_tl0: |
364 | TRAP_INSTRUCTION 20 |
396 | TRAP_INSTRUCTION 20 |
365 | 397 | ||
366 | /* TT = 0x115, TL = 0, trap_instruction_21 */ |
398 | /* TT = 0x115, TL = 0, trap_instruction_21 */ |
367 | .org trap_table + TT_TRAP_INSTRUCTION(21)*ENTRY_SIZE |
399 | .org trap_table + TT_TRAP_INSTRUCTION(21)*ENTRY_SIZE |
368 | .global trap_instruction_21 |
400 | .global trap_instruction_21_tl0 |
369 | trap_instruction_21: |
401 | trap_instruction_21_tl0: |
370 | TRAP_INSTRUCTION 21 |
402 | TRAP_INSTRUCTION 21 |
371 | 403 | ||
372 | /* TT = 0x116, TL = 0, trap_instruction_22 */ |
404 | /* TT = 0x116, TL = 0, trap_instruction_22 */ |
373 | .org trap_table + TT_TRAP_INSTRUCTION(22)*ENTRY_SIZE |
405 | .org trap_table + TT_TRAP_INSTRUCTION(22)*ENTRY_SIZE |
374 | .global trap_instruction_22 |
406 | .global trap_instruction_22_tl0 |
375 | trap_instruction_22: |
407 | trap_instruction_22_tl0: |
376 | TRAP_INSTRUCTION 22 |
408 | TRAP_INSTRUCTION 22 |
377 | 409 | ||
378 | /* TT = 0x117, TL = 0, trap_instruction_23 */ |
410 | /* TT = 0x117, TL = 0, trap_instruction_23 */ |
379 | .org trap_table + TT_TRAP_INSTRUCTION(23)*ENTRY_SIZE |
411 | .org trap_table + TT_TRAP_INSTRUCTION(23)*ENTRY_SIZE |
380 | .global trap_instruction_23 |
412 | .global trap_instruction_23_tl0 |
381 | trap_instruction_23: |
413 | trap_instruction_23_tl0: |
382 | TRAP_INSTRUCTION 23 |
414 | TRAP_INSTRUCTION 23 |
383 | 415 | ||
384 | /* TT = 0x118, TL = 0, trap_instruction_24 */ |
416 | /* TT = 0x118, TL = 0, trap_instruction_24 */ |
385 | .org trap_table + TT_TRAP_INSTRUCTION(24)*ENTRY_SIZE |
417 | .org trap_table + TT_TRAP_INSTRUCTION(24)*ENTRY_SIZE |
386 | .global trap_instruction_24 |
418 | .global trap_instruction_24_tl0 |
387 | trap_instruction_24: |
419 | trap_instruction_24_tl0: |
388 | TRAP_INSTRUCTION 24 |
420 | TRAP_INSTRUCTION 24 |
389 | 421 | ||
390 | /* TT = 0x119, TL = 0, trap_instruction_25 */ |
422 | /* TT = 0x119, TL = 0, trap_instruction_25 */ |
391 | .org trap_table + TT_TRAP_INSTRUCTION(25)*ENTRY_SIZE |
423 | .org trap_table + TT_TRAP_INSTRUCTION(25)*ENTRY_SIZE |
392 | .global trap_instruction_25 |
424 | .global trap_instruction_25_tl0 |
393 | trap_instruction_25: |
425 | trap_instruction_25_tl0: |
394 | TRAP_INSTRUCTION 25 |
426 | TRAP_INSTRUCTION 25 |
395 | 427 | ||
396 | /* TT = 0x11a, TL = 0, trap_instruction_26 */ |
428 | /* TT = 0x11a, TL = 0, trap_instruction_26 */ |
397 | .org trap_table + TT_TRAP_INSTRUCTION(26)*ENTRY_SIZE |
429 | .org trap_table + TT_TRAP_INSTRUCTION(26)*ENTRY_SIZE |
398 | .global trap_instruction_26 |
430 | .global trap_instruction_26_tl0 |
399 | trap_instruction_26: |
431 | trap_instruction_26_tl0: |
400 | TRAP_INSTRUCTION 26 |
432 | TRAP_INSTRUCTION 26 |
401 | 433 | ||
402 | /* TT = 0x11b, TL = 0, trap_instruction_27 */ |
434 | /* TT = 0x11b, TL = 0, trap_instruction_27 */ |
403 | .org trap_table + TT_TRAP_INSTRUCTION(27)*ENTRY_SIZE |
435 | .org trap_table + TT_TRAP_INSTRUCTION(27)*ENTRY_SIZE |
404 | .global trap_instruction_27 |
436 | .global trap_instruction_27_tl0 |
405 | trap_instruction_27: |
437 | trap_instruction_27_tl0: |
406 | TRAP_INSTRUCTION 27 |
438 | TRAP_INSTRUCTION 27 |
407 | 439 | ||
408 | /* TT = 0x11c, TL = 0, trap_instruction_28 */ |
440 | /* TT = 0x11c, TL = 0, trap_instruction_28 */ |
409 | .org trap_table + TT_TRAP_INSTRUCTION(28)*ENTRY_SIZE |
441 | .org trap_table + TT_TRAP_INSTRUCTION(28)*ENTRY_SIZE |
410 | .global trap_instruction_28 |
442 | .global trap_instruction_28_tl0 |
411 | trap_instruction_28: |
443 | trap_instruction_28_tl0: |
412 | TRAP_INSTRUCTION 28 |
444 | TRAP_INSTRUCTION 28 |
413 | 445 | ||
414 | /* TT = 0x11d, TL = 0, trap_instruction_29 */ |
446 | /* TT = 0x11d, TL = 0, trap_instruction_29 */ |
415 | .org trap_table + TT_TRAP_INSTRUCTION(29)*ENTRY_SIZE |
447 | .org trap_table + TT_TRAP_INSTRUCTION(29)*ENTRY_SIZE |
416 | .global trap_instruction_29 |
448 | .global trap_instruction_29_tl0 |
417 | trap_instruction_29: |
449 | trap_instruction_29_tl0: |
418 | TRAP_INSTRUCTION 29 |
450 | TRAP_INSTRUCTION 29 |
419 | 451 | ||
420 | /* TT = 0x11e, TL = 0, trap_instruction_30 */ |
452 | /* TT = 0x11e, TL = 0, trap_instruction_30 */ |
421 | .org trap_table + TT_TRAP_INSTRUCTION(30)*ENTRY_SIZE |
453 | .org trap_table + TT_TRAP_INSTRUCTION(30)*ENTRY_SIZE |
422 | .global trap_instruction_30 |
454 | .global trap_instruction_30_tl0 |
423 | trap_instruction_30: |
455 | trap_instruction_30_tl0: |
424 | TRAP_INSTRUCTION 30 |
456 | TRAP_INSTRUCTION 30 |
425 | 457 | ||
426 | /* TT = 0x11f, TL = 0, trap_instruction_31 */ |
458 | /* TT = 0x11f, TL = 0, trap_instruction_31 */ |
427 | .org trap_table + TT_TRAP_INSTRUCTION(31)*ENTRY_SIZE |
459 | .org trap_table + TT_TRAP_INSTRUCTION(31)*ENTRY_SIZE |
428 | .global trap_instruction_31 |
460 | .global trap_instruction_31_tl0 |
429 | trap_instruction_31: |
461 | trap_instruction_31_tl0: |
430 | TRAP_INSTRUCTION 31 |
462 | TRAP_INSTRUCTION 31 |
431 | 463 | ||
432 | /* |
464 | /* |
433 | * Handlers for TL>0. |
465 | * Handlers for TL>0. |
434 | */ |
466 | */ |
435 | 467 | ||
436 | /* TT = 0x08, TL > 0, instruction_access_exception */ |
468 | /* TT = 0x08, TL > 0, instruction_access_exception */ |
437 | .org trap_table + (TT_INSTRUCTION_ACCESS_EXCEPTION+512)*ENTRY_SIZE |
469 | .org trap_table + (TT_INSTRUCTION_ACCESS_EXCEPTION+512)*ENTRY_SIZE |
438 | .global instruction_access_exception_high |
470 | .global instruction_access_exception_tl1 |
439 | instruction_access_exception_high: |
471 | instruction_access_exception_tl1: |
- | 472 | wrpr %g0, 1, %tl |
|
- | 473 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
|
- | 474 | PREEMPTIBLE_HANDLER instruction_access_exception |
|
- | 475 | ||
- | 476 | /* TT = 0x0a, TL > 0, instruction_access_error */ |
|
- | 477 | .org trap_table + (TT_INSTRUCTION_ACCESS_ERROR+512)*ENTRY_SIZE |
|
- | 478 | .global instruction_access_error_tl1 |
|
- | 479 | instruction_access_error_tl1: |
|
- | 480 | wrpr %g0, 1, %tl |
|
440 | PREEMPTIBLE_HANDLER do_instruction_access_exc |
481 | PREEMPTIBLE_HANDLER instruction_access_error |
441 | 482 | ||
442 | /* TT = 0x10, TL > 0, illegal_instruction */ |
483 | /* TT = 0x10, TL > 0, illegal_instruction */ |
443 | .org trap_table + (TT_ILLEGAL_INSTRUCTION+512)*ENTRY_SIZE |
484 | .org trap_table + (TT_ILLEGAL_INSTRUCTION+512)*ENTRY_SIZE |
444 | .global illegal_instruction_high |
485 | .global illegal_instruction_tl1 |
445 | illegal_instruction_high: |
486 | illegal_instruction_tl1: |
- | 487 | wrpr %g0, 1, %tl |
|
446 | PREEMPTIBLE_HANDLER do_illegal_instruction |
488 | PREEMPTIBLE_HANDLER illegal_instruction |
447 | 489 | ||
448 | /* TT = 0x24, TL > 0, clean_window handler */ |
490 | /* TT = 0x24, TL > 0, clean_window handler */ |
449 | .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE |
491 | .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE |
450 | .global clean_window_handler_high |
492 | .global clean_window_handler_tl1 |
451 | clean_window_handler_high: |
493 | clean_window_handler_tl1: |
452 | CLEAN_WINDOW_HANDLER |
494 | CLEAN_WINDOW_HANDLER |
453 | 495 | ||
- | 496 | /* TT = 0x28, TL > 0, division_by_zero */ |
|
- | 497 | .org trap_table + (TT_DIVISION_BY_ZERO+512)*ENTRY_SIZE |
|
- | 498 | .global division_by_zero_tl1 |
|
- | 499 | division_by_zero_tl1: |
|
- | 500 | wrpr %g0, 1, %tl |
|
- | 501 | PREEMPTIBLE_HANDLER division_by_zero |
|
- | 502 | ||
- | 503 | /* TT = 0x30, TL > 0, data_access_exception */ |
|
- | 504 | .org trap_table + (TT_DATA_ACCESS_EXCEPTION+512)*ENTRY_SIZE |
|
- | 505 | .global data_access_exception_tl1 |
|
- | 506 | data_access_exception_tl1: |
|
- | 507 | wrpr %g0, 1, %tl |
|
- | 508 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
|
- | 509 | PREEMPTIBLE_HANDLER data_access_exception |
|
- | 510 | ||
454 | /* TT = 0x32, TL > 0, data_access_error */ |
511 | /* TT = 0x32, TL > 0, data_access_error */ |
455 | .org trap_table + (TT_DATA_ACCESS_ERROR+512)*ENTRY_SIZE |
512 | .org trap_table + (TT_DATA_ACCESS_ERROR+512)*ENTRY_SIZE |
456 | .global data_access_error_high |
513 | .global data_access_error_tl1 |
457 | data_access_error_high: |
514 | data_access_error_tl1: |
- | 515 | wrpr %g0, 1, %tl |
|
458 | PREEMPTIBLE_HANDLER do_data_access_error |
516 | PREEMPTIBLE_HANDLER data_access_error |
459 | 517 | ||
460 | /* TT = 0x34, TL > 0, mem_address_not_aligned */ |
518 | /* TT = 0x34, TL > 0, mem_address_not_aligned */ |
461 | .org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE |
519 | .org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE |
462 | .global mem_address_not_aligned_high |
520 | .global mem_address_not_aligned_tl1 |
463 | mem_address_not_aligned_high: |
521 | mem_address_not_aligned_tl1: |
464 | MEM_ADDRESS_NOT_ALIGNED_HANDLER |
522 | wrpr %g0, 1, %tl |
465 | - | ||
466 | /* TT = 0x64, TL > 0, fast_instruction_access_MMU_miss */ |
- | |
467 | .org trap_table + (TT_FAST_INSTRUCTION_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
- | |
468 | .global fast_instruction_access_mmu_miss_handler_high |
523 | PREEMPTIBLE_HANDLER mem_address_not_aligned |
469 | fast_instruction_access_mmu_miss_handler_high: |
- | |
470 | FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER |
- | |
471 | 524 | ||
472 | /* TT = 0x68, TL > 0, fast_data_access_MMU_miss */ |
525 | /* TT = 0x68, TL > 0, fast_data_access_MMU_miss */ |
473 | .org trap_table + (TT_FAST_DATA_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
526 | .org trap_table + (TT_FAST_DATA_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
474 | .global fast_data_access_mmu_miss_handler_high |
527 | .global fast_data_access_mmu_miss_handler_tl1 |
475 | fast_data_access_mmu_miss_handler_high: |
528 | fast_data_access_mmu_miss_handler_tl1: |
476 | FAST_DATA_ACCESS_MMU_MISS_HANDLER |
529 | FAST_DATA_ACCESS_MMU_MISS_HANDLER 1 |
477 | 530 | ||
478 | /* TT = 0x6c, TL > 0, fast_data_access_protection */ |
531 | /* TT = 0x6c, TL > 0, fast_data_access_protection */ |
479 | .org trap_table + (TT_FAST_DATA_ACCESS_PROTECTION+512)*ENTRY_SIZE |
532 | .org trap_table + (TT_FAST_DATA_ACCESS_PROTECTION+512)*ENTRY_SIZE |
480 | .global fast_data_access_protection_handler_high |
533 | .global fast_data_access_protection_handler_tl1 |
481 | fast_data_access_protection_handler_high: |
534 | fast_data_access_protection_handler_tl1: |
482 | FAST_DATA_ACCESS_PROTECTION_HANDLER |
535 | FAST_DATA_ACCESS_PROTECTION_HANDLER 1 |
483 | 536 | ||
484 | /* TT = 0x80, TL > 0, spill_0_normal handler */ |
537 | /* TT = 0x80, TL > 0, spill_0_normal handler */ |
485 | .org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE |
538 | .org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE |
486 | .global spill_0_normal_high |
539 | .global spill_0_normal_tl1 |
487 | spill_0_normal_high: |
540 | spill_0_normal_tl1: |
488 | SPILL_NORMAL_HANDLER_KERNEL |
541 | SPILL_NORMAL_HANDLER_KERNEL |
489 | 542 | ||
490 | /* TT = 0x88, TL > 0, spill_2_normal handler */ |
543 | /* TT = 0x88, TL > 0, spill_2_normal handler */ |
491 | .org trap_table + (TT_SPILL_2_NORMAL+512)*ENTRY_SIZE |
544 | .org trap_table + (TT_SPILL_2_NORMAL+512)*ENTRY_SIZE |
492 | .global spill_2_normal_high |
545 | .global spill_2_normal_tl1 |
493 | spill_2_normal_high: |
546 | spill_2_normal_tl1: |
494 | SPILL_TO_USPACE_WINDOW_BUFFER |
547 | SPILL_TO_USPACE_WINDOW_BUFFER |
495 | 548 | ||
496 | /* TT = 0xa0, TL > 0, spill_0_other handler */ |
549 | /* TT = 0xa0, TL > 0, spill_0_other handler */ |
497 | .org trap_table + (TT_SPILL_0_OTHER+512)*ENTRY_SIZE |
550 | .org trap_table + (TT_SPILL_0_OTHER+512)*ENTRY_SIZE |
498 | .global spill_0_other_high |
551 | .global spill_0_other_tl1 |
499 | spill_0_other_high: |
552 | spill_0_other_tl1: |
500 | SPILL_TO_USPACE_WINDOW_BUFFER |
553 | SPILL_TO_USPACE_WINDOW_BUFFER |
501 | 554 | ||
502 | /* TT = 0xc0, TL > 0, fill_0_normal handler */ |
555 | /* TT = 0xc0, TL > 0, fill_0_normal handler */ |
503 | .org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE |
556 | .org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE |
504 | .global fill_0_normal_high |
557 | .global fill_0_normal_tl1 |
505 | fill_0_normal_high: |
558 | fill_0_normal_tl1: |
506 | FILL_NORMAL_HANDLER_KERNEL |
559 | FILL_NORMAL_HANDLER_KERNEL |
507 | 560 | ||
508 | #define NOT(x) ((x) == 0) |
561 | #define NOT(x) ((x) == 0) |
509 | 562 | ||
510 | /* Preemptible trap handler for TL=1. |
563 | /* Preemptible trap handler for TL=1. |
511 | * |
564 | * |
512 | * This trap handler makes arrangements to make calling of scheduler() from |
565 | * This trap handler makes arrangements to make calling of scheduler() from |
513 | * within a trap context possible. It is called from several other trap |
566 | * within a trap context possible. It is called from several other trap |
514 | * handlers. |
567 | * handlers. |
515 | * |
568 | * |
516 | * This function can be entered either with interrupt globals or alternate globals. |
569 | * This function can be entered either with interrupt globals or alternate globals. |
517 | * Memory management trap handlers are obliged to switch to one of those global sets |
570 | * Memory management trap handlers are obliged to switch to one of those global sets |
518 | * prior to calling this function. Register window management functions are not |
571 | * prior to calling this function. Register window management functions are not |
519 | * allowed to modify the alternate global registers. |
572 | * allowed to modify the alternate global registers. |
520 | * |
573 | * |
521 | * Input registers: |
574 | * Input registers: |
522 | * %g1 Address of function to call. |
575 | * %g1 Address of function to call. |
523 | * %g2 First argument for the function. |
576 | * %g2 First argument for the function. |
524 | * %g6 Pre-set as kernel stack base if trap from userspace. |
577 | * %g6 Pre-set as kernel stack base if trap from userspace. |
525 | * %g7 Pre-set as address of the userspace window buffer. |
578 | * %g7 Pre-set as address of the userspace window buffer. |
526 | */ |
579 | */ |
527 | .macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall |
580 | .macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall |
528 | /* |
581 | /* |
529 | * ASSERT(%tl == 1) |
582 | * ASSERT(%tl == 1) |
530 | */ |
583 | */ |
531 | rdpr %tl, %g3 |
584 | rdpr %tl, %g3 |
532 | cmp %g3, 1 |
585 | cmp %g3, 1 |
533 | be 1f |
586 | be 1f |
534 | nop |
587 | nop |
535 | 0: ba 0b ! this for debugging, if we ever get here |
588 | 0: ba 0b ! this for debugging, if we ever get here |
536 | nop ! it will be easy to find |
589 | nop ! it will be easy to find |
537 | 590 | ||
538 | 1: |
591 | 1: |
539 | .if NOT(\is_syscall) |
592 | .if NOT(\is_syscall) |
540 | rdpr %tstate, %g3 |
593 | rdpr %tstate, %g3 |
541 | andcc %g3, TSTATE_PRIV_BIT, %g0 ! if this trap came from the privileged mode... |
594 | andcc %g3, TSTATE_PRIV_BIT, %g0 ! if this trap came from the privileged mode... |
542 | bnz 0f ! ...skip setting of kernel stack and primary context |
595 | bnz 0f ! ...skip setting of kernel stack and primary context |
543 | nop |
596 | nop |
544 | .endif |
597 | .endif |
545 | /* |
598 | /* |
546 | * Normal window spills will go to the userspace window buffer. |
599 | * Normal window spills will go to the userspace window buffer. |
547 | */ |
600 | */ |
548 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(2), %wstate |
601 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(2), %wstate |
549 | 602 | ||
550 | wrpr %g0, NWINDOW - 1, %cleanwin ! prevent unnecessary clean_window exceptions |
603 | wrpr %g0, NWINDOW - 1, %cleanwin ! prevent unnecessary clean_window exceptions |
551 | 604 | ||
552 | /* |
605 | /* |
553 | * Switch to kernel stack. The old stack is |
606 | * Switch to kernel stack. The old stack is |
554 | * automatically saved in the old window's %sp |
607 | * automatically saved in the old window's %sp |
555 | * and the new window's %fp. |
608 | * and the new window's %fp. |
556 | */ |
609 | */ |
557 | save %g6, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
610 | save %g6, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
558 | 611 | ||
559 | .if \is_syscall |
612 | .if \is_syscall |
560 | /* |
613 | /* |
561 | * Copy arguments for the syscall to the new window. |
614 | * Copy arguments for the syscall to the new window. |
562 | */ |
615 | */ |
563 | mov %i0, %o2 |
616 | mov %i0, %o2 |
564 | mov %i1, %o3 |
617 | mov %i1, %o3 |
565 | mov %i2, %o4 |
618 | mov %i2, %o4 |
566 | mov %i3, %o5 |
619 | mov %i3, %o5 |
567 | .endif |
620 | .endif |
568 | 621 | ||
569 | /* |
622 | /* |
570 | * Mark the CANRESTORE windows as OTHER windows. |
623 | * Mark the CANRESTORE windows as OTHER windows. |
571 | */ |
624 | */ |
572 | rdpr %canrestore, %l0 |
625 | rdpr %canrestore, %l0 |
573 | wrpr %l0, %otherwin |
626 | wrpr %l0, %otherwin |
574 | wrpr %g0, %canrestore |
627 | wrpr %g0, %canrestore |
575 | 628 | ||
576 | /* |
629 | /* |
577 | * Switch to primary context 0. |
630 | * Switch to primary context 0. |
578 | */ |
631 | */ |
579 | mov VA_PRIMARY_CONTEXT_REG, %l0 |
632 | mov VA_PRIMARY_CONTEXT_REG, %l0 |
580 | stxa %g0, [%l0] ASI_DMMU |
633 | stxa %g0, [%l0] ASI_DMMU |
581 | rd %pc, %l0 |
634 | rd %pc, %l0 |
582 | flush %l0 |
635 | flush %l0 |
583 | 636 | ||
584 | .if NOT(\is_syscall) |
637 | .if NOT(\is_syscall) |
585 | ba 1f |
638 | ba 1f |
586 | nop |
639 | nop |
587 | 640 | ||
588 | 0: |
641 | 0: |
589 | save %sp, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
642 | save %sp, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
590 | 643 | ||
591 | /* |
644 | /* |
592 | * At this moment, we are using the kernel stack |
645 | * At this moment, we are using the kernel stack |
593 | * and have successfully allocated a register window. |
646 | * and have successfully allocated a register window. |
594 | */ |
647 | */ |
595 | 1: |
648 | 1: |
596 | .endif |
649 | .endif |
597 | /* |
650 | /* |
598 | * Other window spills will go to the userspace window buffer |
651 | * Other window spills will go to the userspace window buffer |
599 | * and normal spills will go to the kernel stack. |
652 | * and normal spills will go to the kernel stack. |
600 | */ |
653 | */ |
601 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(0), %wstate |
654 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(0), %wstate |
602 | 655 | ||
603 | /* |
656 | /* |
604 | * Copy arguments. |
657 | * Copy arguments. |
605 | */ |
658 | */ |
606 | mov %g1, %l0 |
659 | mov %g1, %l0 |
607 | mov %g2, %o0 |
660 | mov %g2, %o0 |
608 | 661 | ||
609 | /* |
662 | /* |
610 | * Save TSTATE, TPC and TNPC aside. |
663 | * Save TSTATE, TPC and TNPC aside. |
611 | */ |
664 | */ |
612 | rdpr %tstate, %g1 |
665 | rdpr %tstate, %g1 |
613 | rdpr %tpc, %g2 |
666 | rdpr %tpc, %g2 |
614 | rdpr %tnpc, %g3 |
667 | rdpr %tnpc, %g3 |
615 | 668 | ||
616 | /* |
669 | /* |
617 | * The following memory accesses will not fault |
670 | * The following memory accesses will not fault |
618 | * because special provisions are made to have |
671 | * because special provisions are made to have |
619 | * the kernel stack of THREAD locked in DTLB. |
672 | * the kernel stack of THREAD locked in DTLB. |
620 | */ |
673 | */ |
621 | stx %g1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE] |
674 | stx %g1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE] |
622 | stx %g2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC] |
675 | stx %g2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC] |
623 | stx %g3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC] |
676 | stx %g3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC] |
624 | 677 | ||
625 | wrpr %g0, 0, %tl |
678 | wrpr %g0, 0, %tl |
626 | wrpr %g0, PSTATE_PRIV_BIT, %pstate |
679 | wrpr %g0, PSTATE_PRIV_BIT, %pstate |
627 | SAVE_GLOBALS |
680 | SAVE_GLOBALS |
628 | 681 | ||
629 | /* |
682 | /* |
630 | * Call the higher-level handler and pass istate as second parameter. |
683 | * Call the higher-level handler and pass istate as second parameter. |
631 | */ |
684 | */ |
632 | call %l0 |
685 | call %l0 |
633 | add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1 |
686 | add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1 |
634 | 687 | ||
635 | .if \is_syscall |
688 | .if \is_syscall |
636 | /* |
689 | /* |
637 | * Copy the value returned by the syscall. |
690 | * Copy the value returned by the syscall. |
638 | */ |
691 | */ |
639 | mov %o0, %i0 |
692 | mov %o0, %i0 |
640 | .endif |
693 | .endif |
641 | 694 | ||
642 | RESTORE_GLOBALS |
695 | RESTORE_GLOBALS |
643 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
696 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
644 | wrpr %g0, 1, %tl |
697 | wrpr %g0, 1, %tl |
645 | 698 | ||
646 | /* |
699 | /* |
647 | * Read TSTATE, TPC and TNPC from saved copy. |
700 | * Read TSTATE, TPC and TNPC from saved copy. |
648 | */ |
701 | */ |
649 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE], %g1 |
702 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE], %g1 |
650 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC], %g2 |
703 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC], %g2 |
651 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC], %g3 |
704 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC], %g3 |
652 | 705 | ||
653 | /* |
706 | /* |
654 | * Restore TSTATE, TPC and TNPC from saved copies. |
707 | * Restore TSTATE, TPC and TNPC from saved copies. |
655 | */ |
708 | */ |
656 | wrpr %g1, 0, %tstate |
709 | wrpr %g1, 0, %tstate |
657 | wrpr %g2, 0, %tpc |
710 | wrpr %g2, 0, %tpc |
658 | wrpr %g3, 0, %tnpc |
711 | wrpr %g3, 0, %tnpc |
659 | 712 | ||
660 | /* |
713 | /* |
661 | * If OTHERWIN is zero, then all the userspace windows have been |
714 | * If OTHERWIN is zero, then all the userspace windows have been |
662 | * spilled to kernel memory (i.e. register window buffer). Moreover, |
715 | * spilled to kernel memory (i.e. register window buffer). Moreover, |
663 | * if the scheduler was called in the meantime, all valid windows |
716 | * if the scheduler was called in the meantime, all valid windows |
664 | * belonging to other threads were spilled by context_restore(). |
717 | * belonging to other threads were spilled by context_restore(). |
665 | * If OTHERWIN is non-zero, then some userspace windows are still |
718 | * If OTHERWIN is non-zero, then some userspace windows are still |
666 | * valid. Others might have been spilled. However, the CWP pointer |
719 | * valid. Others might have been spilled. However, the CWP pointer |
667 | * needs no fixing because the scheduler had not been called. |
720 | * needs no fixing because the scheduler had not been called. |
668 | */ |
721 | */ |
669 | rdpr %otherwin, %l0 |
722 | rdpr %otherwin, %l0 |
670 | brnz %l0, 0f |
723 | brnz %l0, 0f |
671 | nop |
724 | nop |
672 | 725 | ||
673 | /* |
726 | /* |
674 | * OTHERWIN == 0 |
727 | * OTHERWIN == 0 |
675 | */ |
728 | */ |
676 | 729 | ||
677 | /* |
730 | /* |
678 | * If TSTATE.CWP + 1 == CWP, then we still do not have to fix CWP. |
731 | * If TSTATE.CWP + 1 == CWP, then we still do not have to fix CWP. |
679 | */ |
732 | */ |
680 | and %g1, TSTATE_CWP_MASK, %l0 |
733 | and %g1, TSTATE_CWP_MASK, %l0 |
681 | inc %l0 |
734 | inc %l0 |
682 | and %l0, NWINDOW - 1, %l0 ! %l0 mod NWINDOW |
735 | and %l0, NWINDOW - 1, %l0 ! %l0 mod NWINDOW |
683 | rdpr %cwp, %l1 |
736 | rdpr %cwp, %l1 |
684 | cmp %l0, %l1 |
737 | cmp %l0, %l1 |
685 | bz 0f ! CWP is ok |
738 | bz 0f ! CWP is ok |
686 | nop |
739 | nop |
687 | 740 | ||
688 | /* |
741 | /* |
689 | * Fix CWP. |
742 | * Fix CWP. |
690 | * In order to recapitulate, the input registers in the current |
743 | * In order to recapitulate, the input registers in the current |
691 | * window are the output registers of the window to which we want |
744 | * window are the output registers of the window to which we want |
692 | * to restore. Because the fill trap fills only input and local |
745 | * to restore. Because the fill trap fills only input and local |
693 | * registers of a window, we need to preserve those output |
746 | * registers of a window, we need to preserve those output |
694 | * registers manually. |
747 | * registers manually. |
695 | */ |
748 | */ |
696 | mov %sp, %g2 |
749 | mov %sp, %g2 |
697 | stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0] |
750 | stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0] |
698 | stx %i1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1] |
751 | stx %i1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1] |
699 | stx %i2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2] |
752 | stx %i2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2] |
700 | stx %i3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3] |
753 | stx %i3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3] |
701 | stx %i4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4] |
754 | stx %i4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4] |
702 | stx %i5, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5] |
755 | stx %i5, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5] |
703 | stx %i6, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6] |
756 | stx %i6, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6] |
704 | stx %i7, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7] |
757 | stx %i7, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7] |
705 | wrpr %l0, 0, %cwp |
758 | wrpr %l0, 0, %cwp |
706 | mov %g2, %sp |
759 | mov %g2, %sp |
707 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0], %i0 |
760 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0], %i0 |
708 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1], %i1 |
761 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1], %i1 |
709 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2], %i2 |
762 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2], %i2 |
710 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3], %i3 |
763 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3], %i3 |
711 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4], %i4 |
764 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4], %i4 |
712 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5], %i5 |
765 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5], %i5 |
713 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6], %i6 |
766 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6], %i6 |
714 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7], %i7 |
767 | ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7], %i7 |
715 | 768 | ||
716 | /* |
769 | /* |
717 | * OTHERWIN != 0 or fall-through from the OTHERWIN == 0 case. |
770 | * OTHERWIN != 0 or fall-through from the OTHERWIN == 0 case. |
718 | * The CWP has already been restored to the value it had prior to the SAVE |
771 | * The CWP has already been restored to the value it had prior to the SAVE |
719 | * at the beginning of this function. |
772 | * at the beginning of this function. |
720 | */ |
773 | */ |
721 | 0: |
774 | 0: |
722 | .if NOT(\is_syscall) |
775 | .if NOT(\is_syscall) |
723 | rdpr %tstate, %g1 |
776 | rdpr %tstate, %g1 |
724 | andcc %g1, TSTATE_PRIV_BIT, %g0 ! if we are not returning to userspace..., |
777 | andcc %g1, TSTATE_PRIV_BIT, %g0 ! if we are not returning to userspace..., |
725 | bnz 1f ! ...skip restoring userspace windows |
778 | bnz 1f ! ...skip restoring userspace windows |
726 | nop |
779 | nop |
727 | .endif |
780 | .endif |
728 | 781 | ||
729 | /* |
782 | /* |
730 | * Spills and fills will be processed by the {spill,fill}_1_normal |
783 | * Spills and fills will be processed by the {spill,fill}_1_normal |
731 | * handlers. |
784 | * handlers. |
732 | */ |
785 | */ |
733 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate |
786 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate |
734 | 787 | ||
735 | /* |
788 | /* |
736 | * Set primary context according to secondary context. |
789 | * Set primary context according to secondary context. |
737 | */ |
790 | */ |
738 | wr %g0, ASI_DMMU, %asi |
791 | wr %g0, ASI_DMMU, %asi |
739 | ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1 |
792 | ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1 |
740 | stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi |
793 | stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi |
741 | rd %pc, %g1 |
794 | rd %pc, %g1 |
742 | flush %g1 |
795 | flush %g1 |
743 | 796 | ||
744 | rdpr %cwp, %g1 |
797 | rdpr %cwp, %g1 |
745 | rdpr %otherwin, %g2 |
798 | rdpr %otherwin, %g2 |
746 | 799 | ||
747 | /* |
800 | /* |
748 | * Skip all OTHERWIN windows and descend to the first window |
801 | * Skip all OTHERWIN windows and descend to the first window |
749 | * in the userspace window buffer. |
802 | * in the userspace window buffer. |
750 | */ |
803 | */ |
751 | sub %g1, %g2, %g3 |
804 | sub %g1, %g2, %g3 |
752 | dec %g3 |
805 | dec %g3 |
753 | and %g3, NWINDOW - 1, %g3 |
806 | and %g3, NWINDOW - 1, %g3 |
754 | wrpr %g3, 0, %cwp |
807 | wrpr %g3, 0, %cwp |
755 | 808 | ||
756 | /* |
809 | /* |
757 | * CWP is now in the window last saved in the userspace window buffer. |
810 | * CWP is now in the window last saved in the userspace window buffer. |
758 | * Fill all windows stored in the buffer. |
811 | * Fill all windows stored in the buffer. |
759 | */ |
812 | */ |
760 | clr %g4 |
813 | clr %g4 |
761 | set PAGE_SIZE - 1, %g5 |
814 | set PAGE_SIZE - 1, %g5 |
762 | 0: andcc %g7, %g5, %g0 ! PAGE_SIZE alignment check |
815 | 0: andcc %g7, %g5, %g0 ! PAGE_SIZE alignment check |
763 | bz 0f ! %g7 is page-aligned, no more windows to refill |
816 | bz 0f ! %g7 is page-aligned, no more windows to refill |
764 | nop |
817 | nop |
765 | 818 | ||
766 | add %g7, -STACK_WINDOW_SAVE_AREA_SIZE, %g7 |
819 | add %g7, -STACK_WINDOW_SAVE_AREA_SIZE, %g7 |
767 | ldx [%g7 + L0_OFFSET], %l0 |
820 | ldx [%g7 + L0_OFFSET], %l0 |
768 | ldx [%g7 + L1_OFFSET], %l1 |
821 | ldx [%g7 + L1_OFFSET], %l1 |
769 | ldx [%g7 + L2_OFFSET], %l2 |
822 | ldx [%g7 + L2_OFFSET], %l2 |
770 | ldx [%g7 + L3_OFFSET], %l3 |
823 | ldx [%g7 + L3_OFFSET], %l3 |
771 | ldx [%g7 + L4_OFFSET], %l4 |
824 | ldx [%g7 + L4_OFFSET], %l4 |
772 | ldx [%g7 + L5_OFFSET], %l5 |
825 | ldx [%g7 + L5_OFFSET], %l5 |
773 | ldx [%g7 + L6_OFFSET], %l6 |
826 | ldx [%g7 + L6_OFFSET], %l6 |
774 | ldx [%g7 + L7_OFFSET], %l7 |
827 | ldx [%g7 + L7_OFFSET], %l7 |
775 | ldx [%g7 + I0_OFFSET], %i0 |
828 | ldx [%g7 + I0_OFFSET], %i0 |
776 | ldx [%g7 + I1_OFFSET], %i1 |
829 | ldx [%g7 + I1_OFFSET], %i1 |
777 | ldx [%g7 + I2_OFFSET], %i2 |
830 | ldx [%g7 + I2_OFFSET], %i2 |
778 | ldx [%g7 + I3_OFFSET], %i3 |
831 | ldx [%g7 + I3_OFFSET], %i3 |
779 | ldx [%g7 + I4_OFFSET], %i4 |
832 | ldx [%g7 + I4_OFFSET], %i4 |
780 | ldx [%g7 + I5_OFFSET], %i5 |
833 | ldx [%g7 + I5_OFFSET], %i5 |
781 | ldx [%g7 + I6_OFFSET], %i6 |
834 | ldx [%g7 + I6_OFFSET], %i6 |
782 | ldx [%g7 + I7_OFFSET], %i7 |
835 | ldx [%g7 + I7_OFFSET], %i7 |
783 | 836 | ||
784 | dec %g3 |
837 | dec %g3 |
785 | and %g3, NWINDOW - 1, %g3 |
838 | and %g3, NWINDOW - 1, %g3 |
786 | wrpr %g3, 0, %cwp ! switch to the preceeding window |
839 | wrpr %g3, 0, %cwp ! switch to the preceeding window |
787 | 840 | ||
788 | ba 0b |
841 | ba 0b |
789 | inc %g4 |
842 | inc %g4 |
790 | 843 | ||
791 | 0: |
844 | 0: |
792 | /* |
845 | /* |
793 | * Switch back to the proper current window and adjust |
846 | * Switch back to the proper current window and adjust |
794 | * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN. |
847 | * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN. |
795 | */ |
848 | */ |
796 | wrpr %g1, 0, %cwp |
849 | wrpr %g1, 0, %cwp |
797 | add %g4, %g2, %g2 |
850 | add %g4, %g2, %g2 |
798 | cmp %g2, NWINDOW - 2 |
851 | cmp %g2, NWINDOW - 2 |
799 | bg 2f ! fix the CANRESTORE=NWINDOW-1 anomaly |
852 | bg 2f ! fix the CANRESTORE=NWINDOW-1 anomaly |
800 | mov NWINDOW - 2, %g1 ! use dealy slot for both cases |
853 | mov NWINDOW - 2, %g1 ! use dealy slot for both cases |
801 | sub %g1, %g2, %g1 |
854 | sub %g1, %g2, %g1 |
802 | 855 | ||
803 | wrpr %g0, 0, %otherwin |
856 | wrpr %g0, 0, %otherwin |
804 | wrpr %g1, 0, %cansave ! NWINDOW - 2 - CANRESTORE |
857 | wrpr %g1, 0, %cansave ! NWINDOW - 2 - CANRESTORE |
805 | wrpr %g2, 0, %canrestore ! OTHERWIN + windows in the buffer |
858 | wrpr %g2, 0, %canrestore ! OTHERWIN + windows in the buffer |
806 | wrpr %g2, 0, %cleanwin ! avoid information leak |
859 | wrpr %g2, 0, %cleanwin ! avoid information leak |
807 | 860 | ||
808 | 1: |
861 | 1: |
809 | restore |
862 | restore |
810 | 863 | ||
811 | .if \is_syscall |
864 | .if \is_syscall |
812 | done |
865 | done |
813 | .else |
866 | .else |
814 | retry |
867 | retry |
815 | .endif |
868 | .endif |
816 | 869 | ||
817 | /* |
870 | /* |
818 | * We got here in order to avoid inconsistency of the window state registers. |
871 | * We got here in order to avoid inconsistency of the window state registers. |
819 | * If the: |
872 | * If the: |
820 | * |
873 | * |
821 | * save %g6, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
874 | * save %g6, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
822 | * |
875 | * |
823 | * instruction trapped and spilled a register window into the userspace |
876 | * instruction trapped and spilled a register window into the userspace |
824 | * window buffer, we have just restored NWINDOW - 1 register windows. |
877 | * window buffer, we have just restored NWINDOW - 1 register windows. |
825 | * However, CANRESTORE can be only NWINDOW - 2 at most. |
878 | * However, CANRESTORE can be only NWINDOW - 2 at most. |
826 | * |
879 | * |
827 | * The solution is to manually switch to (CWP - 1) mod NWINDOW |
880 | * The solution is to manually switch to (CWP - 1) mod NWINDOW |
828 | * and set the window state registers so that: |
881 | * and set the window state registers so that: |
829 | * |
882 | * |
830 | * CANRESTORE = NWINDOW - 2 |
883 | * CANRESTORE = NWINDOW - 2 |
831 | * CLEANWIN = NWINDOW - 2 |
884 | * CLEANWIN = NWINDOW - 2 |
832 | * CANSAVE = 0 |
885 | * CANSAVE = 0 |
833 | * OTHERWIN = 0 |
886 | * OTHERWIN = 0 |
834 | * |
887 | * |
835 | * The RESTORE isntruction is therfore to be skipped. |
888 | * The RESTORE isntruction is therfore to be skipped. |
836 | */ |
889 | */ |
837 | 2: |
890 | 2: |
838 | wrpr %g0, 0, %otherwin |
891 | wrpr %g0, 0, %otherwin |
839 | wrpr %g0, 0, %cansave |
892 | wrpr %g0, 0, %cansave |
840 | wrpr %g1, 0, %canrestore |
893 | wrpr %g1, 0, %canrestore |
841 | wrpr %g1, 0, %cleanwin |
894 | wrpr %g1, 0, %cleanwin |
842 | 895 | ||
843 | rdpr %cwp, %g1 |
896 | rdpr %cwp, %g1 |
844 | dec %g1 |
897 | dec %g1 |
845 | and %g1, NWINDOW - 1, %g1 |
898 | and %g1, NWINDOW - 1, %g1 |
846 | wrpr %g1, 0, %cwp ! CWP-- |
899 | wrpr %g1, 0, %cwp ! CWP-- |
847 | 900 | ||
848 | .if \is_syscall |
901 | .if \is_syscall |
849 | done |
902 | done |
850 | .else |
903 | .else |
851 | retry |
904 | retry |
852 | .endif |
905 | .endif |
853 | 906 | ||
854 | .endm |
907 | .endm |
855 | 908 | ||
856 | .global preemptible_handler |
909 | .global preemptible_handler |
857 | preemptible_handler: |
910 | preemptible_handler: |
858 | PREEMPTIBLE_HANDLER_TEMPLATE 0 |
911 | PREEMPTIBLE_HANDLER_TEMPLATE 0 |
859 | 912 | ||
860 | .global trap_instruction_handler |
913 | .global trap_instruction_handler |
861 | trap_instruction_handler: |
914 | trap_instruction_handler: |
862 | PREEMPTIBLE_HANDLER_TEMPLATE 1 |
915 | PREEMPTIBLE_HANDLER_TEMPLATE 1 |
863 | 916 |