Changeset feb5915 in mainline
- 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
- Location:
- arch/sparc64
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/sparc64/Makefile.inc
r7614565 rfeb5915 61 61 arch/$(ARCH)/src/trap/trap_table.S \ 62 62 arch/$(ARCH)/src/trap/trap.c \ 63 arch/$(ARCH)/src/trap/exception.c \ 63 64 arch/$(ARCH)/src/trap/interrupt.c \ 64 65 arch/$(ARCH)/src/drivers/tick.c -
arch/sparc64/include/trap/interrupt.h
r7614565 rfeb5915 31 31 */ 32 32 33 #ifndef __sparc64_ INTERRUPT_H__34 #define __sparc64_ INTERRUPT_H__33 #ifndef __sparc64_TRAP_INTERRUPT_H__ 34 #define __sparc64_TRAP_INTERRUPT_H__ 35 35 36 36 #include <arch/trap/trap_table.h> … … 60 60 #ifdef __ASM__ 61 61 .macro INTERRUPT_LEVEL_N_HANDLER n 62 save %sp, - STACK_WINDOW_SAVE_AREA_SIZE, %sp62 save %sp, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp 63 63 mov \n - 1, %o0 64 64 mov %fp, %o1 65 SAVING_HANDLER exc_dispatch65 PREEMPTIBLE_HANDLER exc_dispatch 66 66 .endm 67 67 -
arch/sparc64/include/trap/trap_table.h
r7614565 rfeb5915 72 72 .endm 73 73 74 .macro SAVING_HANDLER f 74 #define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE (STACK_WINDOW_SAVE_AREA_SIZE+(4*8)) 75 #define SAVED_TSTATE -(1*8) 76 #define SAVED_TPC -(2*8) 77 #define SAVED_TNPC -(3*8) 78 #define SAVED_PSTATE -(4*8) 79 80 .macro PREEMPTIBLE_HANDLER f 75 81 set \f, %l0 76 b saving_handler 82 b preemptible_handler 83 nop 84 .endm 85 86 .macro SIMPLE_HANDLER f 87 call \f 77 88 nop 78 89 .endm -
arch/sparc64/src/panic.S
r7614565 rfeb5915 33 33 .global panic_printf 34 34 panic_printf: 35 save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp36 35 call printf 37 36 nop … … 39 38 nop 40 39 /* Not reached. */ 41 restore42 40 -
arch/sparc64/src/trap/trap.c
r7614565 rfeb5915 30 30 #include <arch/trap/trap_table.h> 31 31 #include <arch/trap/regwin.h> 32 #include <arch/trap/exception.h> 32 33 #include <arch/trap/interrupt.h> 33 34 #include <arch/asm.h> … … 54 55 * Install kernel-provided handlers. 55 56 */ 57 trap_install_handler(TT_INSTRUCTION_ACCESS_EXCEPTION, TRAP_TABLE_ENTRY_SIZE, false); 56 58 trap_install_handler(TT_CLEAN_WINDOW, CLEAN_WINDOW_HANDLER_SIZE, false); 59 trap_install_handler(TT_MEM_ADDRESS_NOT_ALIGNED, TRAP_TABLE_ENTRY_SIZE, false); 57 60 trap_install_handler(TT_SPILL_0_NORMAL, SPILL_HANDLER_SIZE, false); 58 61 trap_install_handler(TT_FILL_0_NORMAL, FILL_HANDLER_SIZE, false); 62 trap_install_handler(TT_INSTRUCTION_ACCESS_EXCEPTION, TRAP_TABLE_ENTRY_SIZE, true); 59 63 trap_install_handler(TT_CLEAN_WINDOW, CLEAN_WINDOW_HANDLER_SIZE, true); 64 trap_install_handler(TT_MEM_ADDRESS_NOT_ALIGNED, TRAP_TABLE_ENTRY_SIZE, true); 60 65 trap_install_handler(TT_SPILL_0_NORMAL, SPILL_HANDLER_SIZE, true); 61 66 trap_install_handler(TT_FILL_0_NORMAL, FILL_HANDLER_SIZE, true); -
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.