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