Changeset feb5915 in mainline for arch/sparc64/src/trap/trap_table.S
- Timestamp:
- 2005-12-29T19:17:29Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 80bff342
- Parents:
- 7614565
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/sparc64/src/trap/trap_table.S
r7614565 rfeb5915 49 49 #include <arch/trap/regwin.h> 50 50 #include <arch/trap/interrupt.h> 51 #include <arch/trap/exception.h> 52 #include <arch/stack.h> 51 53 52 54 #define TABLE_SIZE TRAP_TABLE_SIZE … … 59 61 .global trap_table 60 62 trap_table: 63 64 /* TT = 0x08, TL = 0, instruction_access_exception */ 65 .org trap_table + TT_INSTRUCTION_ACCESS_EXCEPTION*ENTRY_SIZE 66 .global instruction_access_exception 67 instruction_access_exception: 68 SIMPLE_HANDLER do_instruction_access_exc 61 69 62 70 /* TT = 0x24, TL = 0, clean_window handler */ … … 66 74 CLEAN_WINDOW_HANDLER 67 75 76 /* TT = 0x34, TL = 0, mem_address_not_aligned */ 77 .org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE 78 .global mem_address_not_aligned 79 mem_address_not_aligned: 80 SIMPLE_HANDLER do_mem_address_not_aligned 81 68 82 /* TT = 0x41, TL = 0, interrupt_level_1 handler */ 69 83 .org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE … … 178 192 */ 179 193 194 /* TT = 0x08, TL > 0, instruction_access_exception */ 195 .org trap_table + (TT_INSTRUCTION_ACCESS_EXCEPTION+512)*ENTRY_SIZE 196 .global instruction_access_exception_high 197 instruction_access_exception_high: 198 SIMPLE_HANDLER do_instruction_access_exc 199 180 200 /* TT = 0x24, TL > 0, clean_window handler */ 181 201 .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE … … 184 204 CLEAN_WINDOW_HANDLER 185 205 206 /* TT = 0x34, TL > 0, mem_address_not_aligned */ 207 .org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE 208 .global mem_address_not_aligned_high 209 mem_address_not_aligned_high: 210 SIMPLE_HANDLER do_mem_address_not_aligned 186 211 187 212 /* TT = 0x80, TL > 0, spill_0_normal handler */ 188 189 213 .org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE 190 214 .global spill_0_normal_high 191 215 spill_0_normal_high: 192 216 SPILL_NORMAL_HANDLER 193 194 217 195 218 /* TT = 0xc0, TL > 0, fill_0_normal handler */ … … 210 233 211 234 212 /* Trap handler that explicitly saves global registers. 235 /* Preemptible trap handler. 236 * 237 * This trap handler makes arrangements to 238 * make calling scheduler() possible. 239 * 240 * The caller is responsible for doing save 241 * and allocating PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE 242 * bytes on stack. 213 243 * 214 244 * Input registers: … … 217 247 * %l1 - %l7 Copy of %g1 - %g7 218 248 */ 219 .global saving_handler 220 saving_handler: 249 .global preemptible_handler 250 preemptible_handler: 251 /* 252 * Save TSTATE, TPC, TNPC and PSTATE aside. 253 */ 254 rdpr %tstate, %g1 255 rdpr %tpc, %g2 256 rdpr %tnpc, %g3 257 rdpr %pstate, %g4 258 259 stx %g1, [%fp + STACK_BIAS + SAVED_TSTATE] 260 stx %g2, [%fp + STACK_BIAS + SAVED_TPC] 261 stx %g3, [%fp + STACK_BIAS + SAVED_TNPC] 262 stx %g4, [%fp + STACK_BIAS + SAVED_PSTATE] 263 264 /* 265 * Write 0 to TL. 266 */ 267 wrpr %g0, 0, %tl 268 269 /* 270 * Alter PSTATE. 271 * - switch to normal globals. 272 */ 273 and %g4, ~1, %g4 ! mask alternate globals 274 wrpr %g4, 0, %pstate 275 276 /* 277 * Save the normal globals. 278 */ 221 279 SAVE_GLOBALS 280 281 /* 282 * Call the higher-level handler. 283 */ 222 284 call %l0 223 285 nop 286 287 /* 288 * Restore the normal global register set. 289 */ 224 290 RESTORE_GLOBALS 225 restore /* matches the save instruction from the top-level handler */ 291 292 /* 293 * Restore PSTATE from saved copy. 294 * Alternate globals become active. 295 */ 296 ldx [%fp + STACK_BIAS + SAVED_PSTATE], %l4 297 wrpr %l4, 0, %pstate 298 299 /* 300 * Write 1 to TL. 301 */ 302 wrpr %g0, 1, %tl 303 304 /* 305 * Read TSTATE, TPC and TNPC from saved copy. 306 */ 307 ldx [%fp + STACK_BIAS + SAVED_TSTATE], %g1 308 ldx [%fp + STACK_BIAS + SAVED_TPC], %g2 309 ldx [%fp + STACK_BIAS + SAVED_TNPC], %g3 310 311 /* 312 * Do restore to match the save instruction from the top-level handler. 313 */ 314 restore 315 316 /* 317 * On execution of retry instruction, CWP will be restored from TSTATE register. 318 * However, because of scheduling, it is possible that CWP in saved TSTATE 319 * is different from current CWP. The following chunk of code fixes CWP 320 * in the saved copy of TSTATE. 321 */ 322 rdpr %cwp, %g4 ! read current CWP 323 and %g1, ~0x1f, %g1 ! clear CWP field in saved TSTATE 324 or %g1, %g4, %g1 ! write current CWP to TSTATE 325 326 /* 327 * Restore TSTATE, TPC and TNPC from saved copies. 328 */ 329 wrpr %g1, 0, %tstate 330 wrpr %g2, 0, %tpc 331 wrpr %g3, 0, %tnpc 332 333 /* 334 * Return from interrupt. 335 */ 226 336 retry
Note:
See TracChangeset
for help on using the changeset viewer.