Rev 663 | Rev 666 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 663 | Rev 664 | ||
---|---|---|---|
1 | # |
1 | # |
2 | # Copyright (C) 2005 Jakub Jermar |
2 | # Copyright (C) 2005 Jakub Jermar |
3 | # All rights reserved. |
3 | # All rights reserved. |
4 | # |
4 | # |
5 | # Redistribution and use in source and binary forms, with or without |
5 | # Redistribution and use in source and binary forms, with or without |
6 | # modification, are permitted provided that the following conditions |
6 | # modification, are permitted provided that the following conditions |
7 | # are met: |
7 | # are met: |
8 | # |
8 | # |
9 | # - Redistributions of source code must retain the above copyright |
9 | # - Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. |
10 | # notice, this list of conditions and the following disclaimer. |
11 | # - Redistributions in binary form must reproduce the above copyright |
11 | # - Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the |
12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. |
13 | # documentation and/or other materials provided with the distribution. |
14 | # - The name of the author may not be used to endorse or promote products |
14 | # - The name of the author may not be used to endorse or promote products |
15 | # derived from this software without specific prior written permission. |
15 | # derived from this software without specific prior written permission. |
16 | # |
16 | # |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
27 | # |
28 | 28 | ||
29 | /** |
29 | /** |
30 | * This file contains two trap tables. |
30 | * This file contains two trap tables. |
31 | * First, trap_table, is the one wich contains handlers implemented by |
31 | * First, trap_table, is the one wich contains handlers implemented by |
32 | * kernel. During initialization, these handlers are copied out to |
32 | * kernel. During initialization, these handlers are copied out to |
33 | * the second trap table, trap_table_save, and the first table is |
33 | * the second trap table, trap_table_save, and the first table is |
34 | * overwritten with copy of OFW's own trap table. The copy is then patched |
34 | * overwritten with copy of OFW's own trap table. The copy is then patched |
35 | * from the trap_table_save. |
35 | * from the trap_table_save. |
36 | * |
36 | * |
37 | * This arrangement is beneficial because kernel handlers stay on their |
37 | * This arrangement is beneficial because kernel handlers stay on their |
38 | * link-time addresses which is good for debugging. |
38 | * link-time addresses which is good for debugging. |
39 | */ |
39 | */ |
40 | 40 | ||
41 | .text |
41 | .text |
42 | 42 | ||
43 | #include <arch/trap/trap_table.h> |
43 | #include <arch/trap/trap_table.h> |
44 | #include <arch/trap/regwin.h> |
44 | #include <arch/trap/regwin.h> |
45 | #include <arch/trap/interrupt.h> |
45 | #include <arch/trap/interrupt.h> |
46 | 46 | ||
47 | #define TABLE_SIZE TRAP_TABLE_SIZE |
47 | #define TABLE_SIZE TRAP_TABLE_SIZE |
48 | #define ENTRY_SIZE TRAP_TABLE_ENTRY_SIZE |
48 | #define ENTRY_SIZE TRAP_TABLE_ENTRY_SIZE |
49 | 49 | ||
50 | /* |
50 | /* |
51 | * Kernel trap table. |
51 | * Kernel trap table. |
52 | */ |
52 | */ |
53 | .align TABLE_SIZE |
53 | .align TABLE_SIZE |
54 | .global trap_table |
54 | .global trap_table |
55 | trap_table: |
55 | trap_table: |
56 | 56 | ||
57 | /* TT = 0x24, TL = 0, clean_window handler */ |
57 | /* TT = 0x24, TL = 0, clean_window handler */ |
58 | .org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE |
58 | .org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE |
59 | .global clean_window_handler |
59 | .global clean_window_handler |
60 | clean_window_handler: |
60 | clean_window_handler: |
61 | CLEAN_WINDOW_HANDLER |
61 | CLEAN_WINDOW_HANDLER |
62 | 62 | ||
- | 63 | /* TT = 0x41, TL = 0, interrupt_level_1 handler */ |
|
- | 64 | .org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE |
|
- | 65 | .global interrupt_level_1_handler |
|
- | 66 | interrupt_level_1_handler: |
|
- | 67 | INTERRUPT_LEVEL_N_HANDLER 1 |
|
- | 68 | ||
- | 69 | /* TT = 0x42, TL = 0, interrupt_level_2 handler */ |
|
- | 70 | .org trap_table + TT_INTERRUPT_LEVEL_2*ENTRY_SIZE |
|
- | 71 | .global interrupt_level_2_handler |
|
- | 72 | interrupt_level_2_handler: |
|
- | 73 | INTERRUPT_LEVEL_N_HANDLER 2 |
|
- | 74 | ||
- | 75 | /* TT = 0x43, TL = 0, interrupt_level_3 handler */ |
|
- | 76 | .org trap_table + TT_INTERRUPT_LEVEL_3*ENTRY_SIZE |
|
- | 77 | .global interrupt_level_3_handler |
|
- | 78 | interrupt_level_3_handler: |
|
- | 79 | INTERRUPT_LEVEL_N_HANDLER 3 |
|
- | 80 | ||
- | 81 | /* TT = 0x44, TL = 0, interrupt_level_4 handler */ |
|
- | 82 | .org trap_table + TT_INTERRUPT_LEVEL_4*ENTRY_SIZE |
|
- | 83 | .global interrupt_level_4_handler |
|
- | 84 | interrupt_level_4_handler: |
|
- | 85 | INTERRUPT_LEVEL_N_HANDLER 4 |
|
- | 86 | ||
- | 87 | /* TT = 0x45, TL = 0, interrupt_level_5 handler */ |
|
- | 88 | .org trap_table + TT_INTERRUPT_LEVEL_5*ENTRY_SIZE |
|
- | 89 | .global interrupt_level_5_handler |
|
- | 90 | interrupt_level_5_handler: |
|
- | 91 | INTERRUPT_LEVEL_N_HANDLER 5 |
|
- | 92 | ||
- | 93 | /* TT = 0x46, TL = 0, interrupt_level_6 handler */ |
|
- | 94 | .org trap_table + TT_INTERRUPT_LEVEL_6*ENTRY_SIZE |
|
- | 95 | .global interrupt_level_6_handler |
|
- | 96 | interrupt_level_6_handler: |
|
- | 97 | INTERRUPT_LEVEL_N_HANDLER 6 |
|
- | 98 | ||
- | 99 | /* TT = 0x47, TL = 0, interrupt_level_7 handler */ |
|
- | 100 | .org trap_table + TT_INTERRUPT_LEVEL_7*ENTRY_SIZE |
|
- | 101 | .global interrupt_level_7_handler |
|
- | 102 | interrupt_level_7_handler: |
|
- | 103 | INTERRUPT_LEVEL_N_HANDLER 7 |
|
- | 104 | ||
- | 105 | /* TT = 0x48, TL = 0, interrupt_level_8 handler */ |
|
- | 106 | .org trap_table + TT_INTERRUPT_LEVEL_8*ENTRY_SIZE |
|
- | 107 | .global interrupt_level_8_handler |
|
- | 108 | interrupt_level_8_handler: |
|
- | 109 | INTERRUPT_LEVEL_N_HANDLER 8 |
|
- | 110 | ||
- | 111 | /* TT = 0x49, TL = 0, interrupt_level_9 handler */ |
|
- | 112 | .org trap_table + TT_INTERRUPT_LEVEL_9*ENTRY_SIZE |
|
- | 113 | .global interrupt_level_9_handler |
|
- | 114 | interrupt_level_9_handler: |
|
- | 115 | INTERRUPT_LEVEL_N_HANDLER 9 |
|
- | 116 | ||
- | 117 | /* TT = 0x4a, TL = 0, interrupt_level_10 handler */ |
|
- | 118 | .org trap_table + TT_INTERRUPT_LEVEL_10*ENTRY_SIZE |
|
- | 119 | .global interrupt_level_10_handler |
|
- | 120 | interrupt_level_10_handler: |
|
- | 121 | INTERRUPT_LEVEL_N_HANDLER 10 |
|
- | 122 | ||
- | 123 | /* TT = 0x4b, TL = 0, interrupt_level_11 handler */ |
|
- | 124 | .org trap_table + TT_INTERRUPT_LEVEL_11*ENTRY_SIZE |
|
- | 125 | .global interrupt_level_11_handler |
|
- | 126 | interrupt_level_11_handler: |
|
- | 127 | INTERRUPT_LEVEL_N_HANDLER 11 |
|
- | 128 | ||
- | 129 | /* TT = 0x4c, TL = 0, interrupt_level_12 handler */ |
|
- | 130 | .org trap_table + TT_INTERRUPT_LEVEL_12*ENTRY_SIZE |
|
- | 131 | .global interrupt_level_12_handler |
|
- | 132 | interrupt_level_12_handler: |
|
- | 133 | INTERRUPT_LEVEL_N_HANDLER 12 |
|
- | 134 | ||
- | 135 | /* TT = 0x4d, TL = 0, interrupt_level_13 handler */ |
|
- | 136 | .org trap_table + TT_INTERRUPT_LEVEL_13*ENTRY_SIZE |
|
- | 137 | .global interrupt_level_13_handler |
|
- | 138 | interrupt_level_13_handler: |
|
- | 139 | INTERRUPT_LEVEL_N_HANDLER 13 |
|
- | 140 | ||
- | 141 | /* TT = 0x4e, TL = 0, interrupt_level_14 handler */ |
|
- | 142 | .org trap_table + TT_INTERRUPT_LEVEL_14*ENTRY_SIZE |
|
- | 143 | .global interrupt_level_14_handler |
|
- | 144 | interrupt_level_14_handler: |
|
- | 145 | INTERRUPT_LEVEL_N_HANDLER 14 |
|
- | 146 | ||
- | 147 | /* TT = 0x4f, TL = 0, interrupt_level_15 handler */ |
|
- | 148 | .org trap_table + TT_INTERRUPT_LEVEL_15*ENTRY_SIZE |
|
- | 149 | .global interrupt_level_15_handler |
|
- | 150 | interrupt_level_15_handler: |
|
- | 151 | INTERRUPT_LEVEL_N_HANDLER 15 |
|
- | 152 | ||
63 | /* TT = 0x60, TL = 0, interrupt_vector_trap handler */ |
153 | /* TT = 0x60, TL = 0, interrupt_vector_trap handler */ |
64 | .org trap_table + TT_INTERRUPT_VECTOR_TRAP*ENTRY_SIZE |
154 | .org trap_table + TT_INTERRUPT_VECTOR_TRAP*ENTRY_SIZE |
65 | .global interrupt_vector_trap_handler |
155 | .global interrupt_vector_trap_handler |
66 | interrupt_vector_trap_handler: |
156 | interrupt_vector_trap_handler: |
67 | INTERRUPT_VECTOR_TRAP_HANDLER |
157 | INTERRUPT_VECTOR_TRAP_HANDLER |
68 | 158 | ||
69 | /* TT = 0x80, TL = 0, spill_0_normal handler */ |
159 | /* TT = 0x80, TL = 0, spill_0_normal handler */ |
70 | .org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE |
160 | .org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE |
71 | .global spill_0_normal |
161 | .global spill_0_normal |
72 | spill_0_normal: |
162 | spill_0_normal: |
73 | SPILL_NORMAL_HANDLER |
163 | SPILL_NORMAL_HANDLER |
74 | 164 | ||
75 | /* TT = 0xc0, TL = 0, fill_0_normal handler */ |
165 | /* TT = 0xc0, TL = 0, fill_0_normal handler */ |
76 | .org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE |
166 | .org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE |
77 | .global fill_0_normal |
167 | .global fill_0_normal |
78 | fill_0_normal: |
168 | fill_0_normal: |
79 | FILL_NORMAL_HANDLER |
169 | FILL_NORMAL_HANDLER |
80 | 170 | ||
81 | /* |
171 | /* |
82 | * Handlers for TL>0. |
172 | * Handlers for TL>0. |
83 | */ |
173 | */ |
84 | 174 | ||
85 | /* TT = 0x24, TL > 0, clean_window handler */ |
175 | /* TT = 0x24, TL > 0, clean_window handler */ |
86 | .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE |
176 | .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE |
87 | .global clean_window_handler_high |
177 | .global clean_window_handler_high |
88 | clean_window_handler_high: |
178 | clean_window_handler_high: |
89 | CLEAN_WINDOW_HANDLER |
179 | CLEAN_WINDOW_HANDLER |
90 | 180 | ||
91 | 181 | ||
92 | /* TT = 0x80, TL > 0, spill_0_normal handler */ |
182 | /* TT = 0x80, TL > 0, spill_0_normal handler */ |
93 | 183 | ||
94 | .org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE |
184 | .org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE |
95 | .global spill_0_normal_high |
185 | .global spill_0_normal_high |
96 | spill_0_normal_high: |
186 | spill_0_normal_high: |
97 | SPILL_NORMAL_HANDLER |
187 | SPILL_NORMAL_HANDLER |
98 | 188 | ||
99 | 189 | ||
100 | /* TT = 0xc0, TL > 0, fill_0_normal handler */ |
190 | /* TT = 0xc0, TL > 0, fill_0_normal handler */ |
101 | .org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE |
191 | .org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE |
102 | .global fill_0_normal_high |
192 | .global fill_0_normal_high |
103 | fill_0_normal_high: |
193 | fill_0_normal_high: |
104 | FILL_NORMAL_HANDLER |
194 | FILL_NORMAL_HANDLER |
105 | 195 | ||
106 | 196 | ||
107 | 197 | ||
108 | /* |
198 | /* |
109 | * Save trap table. |
199 | * Save trap table. |
110 | */ |
200 | */ |
111 | .align TABLE_SIZE |
201 | .align TABLE_SIZE |
112 | .global trap_table_save |
202 | .global trap_table_save |
113 | trap_table_save: |
203 | trap_table_save: |
114 | .space TABLE_SIZE, 0 |
204 | .space TABLE_SIZE, 0 |
115 | 205 |