Changeset d70ebffe in mainline
- Timestamp:
- 2014-10-27T15:10:14Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aef669b
- Parents:
- ec443d5
- Location:
- kernel/arch
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc32/include/arch/stack.h
rec443d5 rd70ebffe 54 54 #define STACK_ARG_SAVE_AREA_SIZE (6 * STACK_ITEM_SIZE) 55 55 56 /**57 * Offsets of arguments on stack.58 */59 #define STACK_ARG0 060 #define STACK_ARG1 461 #define STACK_ARG2 862 #define STACK_ARG3 1263 #define STACK_ARG4 1664 #define STACK_ARG5 2065 #define STACK_ARG6 2466 67 56 #endif 68 57 -
kernel/arch/sparc64/include/arch/istate_struct.ag
rec443d5 rd70ebffe 41 41 42 42 members : [ 43 44 # 45 # Window save area for locals and inputs. Required by ABI. 46 # Before using these, make sure that the corresponding register 47 # window has been spilled into memory, otherwise l0-l7 and 48 # i0-i7 will have undefined values. 49 # 50 { 51 name : l0, 52 type : uint64_t, 53 }, 54 { 55 name : l1, 56 type : uint64_t, 57 }, 58 { 59 name : l2, 60 type : uint64_t, 61 }, 62 { 63 name : l3, 64 type : uint64_t, 65 }, 66 { 67 name : l4, 68 type : uint64_t, 69 }, 70 { 71 name : l5, 72 type : uint64_t, 73 }, 74 { 75 name : l6, 76 type : uint64_t, 77 }, 78 { 79 name : l7, 80 type : uint64_t, 81 }, 82 { 83 name : i0, 84 type : uint64_t, 85 }, 86 { 87 name : i1, 88 type : uint64_t, 89 }, 90 { 91 name : i2, 92 type : uint64_t, 93 }, 94 { 95 name : i3, 96 type : uint64_t, 97 }, 98 { 99 name : i4, 100 type : uint64_t, 101 }, 102 { 103 name : i5, 104 type : uint64_t, 105 }, 106 { 107 name : i6, 108 type : uint64_t, 109 }, 110 { 111 name : i7, 112 type : uint64_t, 113 }, 114 115 # 116 # Six mandatory argument slots, required by the ABI, plus an 117 # optional argument slot for the 7th argument used by our 118 # syscalls. Since the preemptible handler is always passing 119 # integral arguments, undef_arg[0] - undef_arg[5] are always 120 # undefined. 121 # 122 { 123 name : undef_arg, 124 type : uint64_t, 125 elements : 6, 126 }, 127 { 128 name : arg6, 129 type : uint64_t, 130 }, 131 132 # 133 # From this point onwards, the istate layout is not dicated by 134 # the ABI. The only requirement is the stack alignment. 135 # 136 43 137 { 44 138 name : tnpc, … … 51 145 { 52 146 name : tstate, 147 type : uint64_t 148 }, 149 { 150 name : y, 151 type : uint64_t, 152 }, 153 154 # 155 # At the moment, these are defined only when needed by the 156 # preemptible handler, so consider them undefined for now. 157 # 158 { 159 name : o0, 160 type : uint64_t, 161 }, 162 { 163 name : o1, 164 type : uint64_t, 165 }, 166 { 167 name : o2, 168 type : uint64_t, 169 }, 170 { 171 name : o3, 172 type : uint64_t, 173 }, 174 { 175 name : o4, 176 type : uint64_t, 177 }, 178 { 179 name : o5, 180 type : uint64_t, 181 }, 182 { 183 name : o6, 184 type : uint64_t, 185 }, 186 { 187 name : o7, 188 type : uint64_t, 189 }, 190 191 # 192 # I/DTLB Tag Access register or zero for non-MMU traps. 193 # 194 { 195 name : tlb_tag_access, 53 196 type : uint64_t 54 197 } -
kernel/arch/sparc64/include/arch/mm/sun4u/tlb.h
rec443d5 rd70ebffe 678 678 } 679 679 680 extern void fast_instruction_access_mmu_miss( sysarg_t, istate_t *);681 extern void fast_data_access_mmu_miss( tlb_tag_access_reg_t, istate_t *);682 extern void fast_data_access_protection( tlb_tag_access_reg_t, istate_t *);680 extern void fast_instruction_access_mmu_miss(unsigned int, istate_t *); 681 extern void fast_data_access_mmu_miss(unsigned int, istate_t *); 682 extern void fast_data_access_protection(unsigned int, istate_t *); 683 683 684 684 extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool); -
kernel/arch/sparc64/include/arch/trap/sun4u/mmu.h
rec443d5 rd70ebffe 74 74 0: 75 75 wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate 76 PREEMPTIBLE_HANDLER fast_instruction_access_mmu_miss 76 mov TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, %g2 77 mov VA_IMMU_TAG_ACCESS, %g5 78 ldxa [%g5] ASI_IMMU, %g5 ! read the faulting Context and VPN 79 PREEMPTIBLE_HANDLER exc_dispatch 77 80 .endm 78 81 … … 107 110 wr %g0, ASI_DMMU, %asi 108 111 ldxa [VA_DMMU_TAG_ACCESS] %asi, %g1 ! read the faulting Context and VPN 109 set TLB_TAG_ACCESS_CONTEXT_MASK, %g2112 ldx [%g7 + %lo(tlb_tag_access_context_mask)], %g2 110 113 andcc %g1, %g2, %g3 ! get Context 111 114 bnz %xcc, 0f ! Context is non-zero … … 138 141 wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate 139 142 140 /* 141 * Read the Tag Access register for the higher-level handler. 142 * This is necessary to survive nested DTLB misses. 143 */ 144 ldxa [VA_DMMU_TAG_ACCESS] %asi, %g2 145 146 /* 147 * g2 will be passed as an argument to fast_data_access_mmu_miss(). 148 */ 149 PREEMPTIBLE_HANDLER fast_data_access_mmu_miss 143 mov TT_FAST_DATA_ACCESS_MMU_MISS, %g2 144 ldxa [VA_DMMU_TAG_ACCESS] %asi, %g5 ! read the faulting Context and VPN 145 PREEMPTIBLE_HANDLER exc_dispatch 150 146 .endm 151 147 … … 164 160 wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate 165 161 166 /* 167 * Read the Tag Access register for the higher-level handler. 168 * This is necessary to survive nested DTLB misses. 169 */ 170 mov VA_DMMU_TAG_ACCESS, %g2 171 ldxa [%g2] ASI_DMMU, %g2 172 173 /* 174 * g2 will be passed as an argument to fast_data_access_mmu_miss(). 175 */ 176 PREEMPTIBLE_HANDLER fast_data_access_protection 162 mov TT_FAST_DATA_ACCESS_PROTECTION, %g2 163 mov VA_DMMU_TAG_ACCESS, %g5 164 ldxa [%g5] ASI_DMMU, %g5 ! read the faulting Context and VPN 165 PREEMPTIBLE_HANDLER exc_dispatch 177 166 .endm 178 167 -
kernel/arch/sparc64/include/arch/trap/trap_table.h
rec443d5 rd70ebffe 43 43 #define TRAP_TABLE_SIZE (TRAP_TABLE_ENTRY_COUNT * TRAP_TABLE_ENTRY_SIZE) 44 44 45 #define ISTATE_END_OFFSET(o) ((o) - ISTATE_SIZE)46 47 /*48 * The one STACK_ITEM_SIZE is counted for space holding the 7th49 * argument to syscall_handler (i.e. syscall number) and the other50 * STACK_ITEM_SIZE is counted because of the required alignment.51 */52 #define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE \53 (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE + \54 (2 * STACK_ITEM_SIZE) + (ISTATE_SIZE + 9 * 8))55 /* <-- istate_t ends here */56 #define SAVED_TSTATE ISTATE_END_OFFSET(ISTATE_OFFSET_TSTATE)57 #define SAVED_TPC ISTATE_END_OFFSET(ISTATE_OFFSET_TPC)58 #define SAVED_TNPC ISTATE_END_OFFSET(ISTATE_OFFSET_TNPC)59 /* <-- istate_t begins here */60 #define SAVED_Y -(1 * 8 + ISTATE_SIZE)61 #define SAVED_I0 -(2 * 8 + ISTATE_SIZE)62 #define SAVED_I1 -(3 * 8 + ISTATE_SIZE)63 #define SAVED_I2 -(4 * 8 + ISTATE_SIZE)64 #define SAVED_I3 -(5 * 8 + ISTATE_SIZE)65 #define SAVED_I4 -(6 * 8 + ISTATE_SIZE)66 #define SAVED_I5 -(7 * 8 + ISTATE_SIZE)67 #define SAVED_I6 -(8 * 8 + ISTATE_SIZE)68 #define SAVED_I7 -(9 * 8 + ISTATE_SIZE)69 70 45 #ifndef __ASM__ 71 46 … … 80 55 extern trap_table_entry_t trap_table[TRAP_TABLE_ENTRY_COUNT]; 81 56 extern trap_table_entry_t trap_table_save[TRAP_TABLE_ENTRY_COUNT]; 57 82 58 #endif /* !__ASM__ */ 83 59 -
kernel/arch/sparc64/src/debug/stacktrace.c
rec443d5 rd70ebffe 42 42 #include <arch/trap/trap_table.h> 43 43 44 #include <arch/istate_struct.h> 45 44 46 #if defined(SUN4V) 45 47 #include <arch/sun4v/arch.h> … … 62 64 63 65 kstack += STACK_BIAS; 64 kstack -= PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE;66 kstack -= ISTATE_SIZE; 65 67 66 68 if (THREAD && (ctx->fp == kstack)) -
kernel/arch/sparc64/src/mm/sun4u/tlb.c
rec443d5 rd70ebffe 194 194 195 195 /** ITLB miss handler. */ 196 void fast_instruction_access_mmu_miss( sysarg_t unused, istate_t *istate)196 void fast_instruction_access_mmu_miss(unsigned int tt, istate_t *istate) 197 197 { 198 198 size_t index = (istate->tpc >> MMU_PAGE_WIDTH) % MMU_PAGES_PER_PAGE; … … 224 224 * low-level, assembly language part of the fast_data_access_mmu_miss handler. 225 225 * 226 * @param tag Content of the TLB Tag Access register as it existed 227 * when the trap happened. This is to prevent confusion 228 * created by clobbered Tag Access register during a nested 229 * DTLB miss. 226 * @param tt Trap type. 230 227 * @param istate Interrupted state saved on the stack. 231 228 */ 232 void fast_data_access_mmu_miss(tlb_tag_access_reg_t tag, istate_t *istate) 233 { 229 void fast_data_access_mmu_miss(unsigned int tt, istate_t *istate) 230 { 231 tlb_tag_access_reg_t tag; 234 232 uintptr_t page_8k; 235 233 uintptr_t page_16k; … … 238 236 as_t *as = AS; 239 237 238 tag.value = istate->tlb_tag_access; 240 239 page_8k = (uint64_t) tag.vpn << MMU_PAGE_WIDTH; 241 240 page_16k = ALIGN_DOWN(page_8k, PAGE_SIZE); … … 276 275 /** DTLB protection fault handler. 277 276 * 278 * @param tag Content of the TLB Tag Access register as it existed 279 * when the trap happened. This is to prevent confusion 280 * created by clobbered Tag Access register during a nested 281 * DTLB miss. 277 * @param tt Trap type. 282 278 * @param istate Interrupted state saved on the stack. 283 279 */ 284 void fast_data_access_protection(tlb_tag_access_reg_t tag, istate_t *istate) 285 { 280 void fast_data_access_protection(unsigned int tt, istate_t *istate) 281 { 282 tlb_tag_access_reg_t tag; 286 283 uintptr_t page_16k; 287 284 size_t index; … … 289 286 as_t *as = AS; 290 287 288 tag.value = istate->tlb_tag_access; 291 289 page_16k = ALIGN_DOWN((uint64_t) tag.vpn << MMU_PAGE_WIDTH, PAGE_SIZE); 292 290 index = tag.vpn % MMU_PAGES_PER_PAGE; /* 16K-page emulation */ -
kernel/arch/sparc64/src/sun4u/start.S
rec443d5 rd70ebffe 401 401 402 402 /* 403 * The fast_data_access_mmu_miss_data_hi label and the end_of_identity and404 * kernel_8k_tlb_data_template variables are meant to stay together,405 * a ligned on 16B boundary.403 * The fast_data_access_mmu_miss_data_hi label, the end_of_identity, 404 * kernel_8k_tlb_data_template and tlb_tag_access_context_mask variables 405 * are meant to stay together, aligned on a 32B boundary. 406 406 */ 407 407 .global fast_data_access_mmu_miss_data_hi 408 408 .global end_of_identity 409 409 .global kernel_8k_tlb_data_template 410 411 .align 16 410 .global tlb_tag_access_context_mask 411 412 .align 32 412 413 /* 413 414 * This label is used by the fast_data_access_MMU_miss trap handler. … … 435 436 #endif /* CONFIG_VIRT_IDX_DCACHE */ 436 437 438 /* 439 * This variable is used by the fast_data_access_MMU_miss trap handler. 440 * It allows us to save one precious instruction slot of this handler. 441 */ 442 tlb_tag_access_context_mask: 443 .quad TLB_TAG_ACCESS_CONTEXT_MASK 444 -
kernel/arch/sparc64/src/trap/interrupt.c
rec443d5 rd70ebffe 37 37 #include <arch/trap/interrupt.h> 38 38 #include <arch/trap/exception.h> 39 #include <arch/trap/mmu.h> 39 40 #include <arch/sparc64.h> 40 41 #include <interrupt.h> … … 120 121 interrupt); 121 122 #endif 122 123 124 exc_register(TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, 125 "fast_instruction_access_mmu_miss", true, 126 fast_instruction_access_mmu_miss); 127 exc_register(TT_FAST_DATA_ACCESS_MMU_MISS, 128 "fast_data_access_mmu_miss", true, 129 fast_data_access_mmu_miss); 130 exc_register(TT_FAST_DATA_ACCESS_PROTECTION, 131 "fast_data_access_protection", true, 132 fast_data_access_protection); 123 133 } 124 134 -
kernel/arch/sparc64/src/trap/sun4u/trap_table.S
rec443d5 rd70ebffe 64 64 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 65 65 mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2 66 clr %g5 66 67 PREEMPTIBLE_HANDLER exc_dispatch 67 68 … … 71 72 instruction_access_error_tl0: 72 73 mov TT_INSTRUCTION_ACCESS_ERROR, %g2 74 clr %g5 73 75 PREEMPTIBLE_HANDLER exc_dispatch 74 76 … … 78 80 illegal_instruction_tl0: 79 81 mov TT_ILLEGAL_INSTRUCTION, %g2 82 clr %g5 80 83 PREEMPTIBLE_HANDLER exc_dispatch 81 84 … … 85 88 privileged_opcode_tl0: 86 89 mov TT_PRIVILEGED_OPCODE, %g2 90 clr %g5 87 91 PREEMPTIBLE_HANDLER exc_dispatch 88 92 … … 92 96 unimplemented_LDD_tl0: 93 97 mov TT_UNIMPLEMENTED_LDD, %g2 98 clr %g5 94 99 PREEMPTIBLE_HANDLER exc_dispatch 95 100 … … 99 104 unimplemented_STD_tl0: 100 105 mov TT_UNIMPLEMENTED_STD, %g2 106 clr %g5 101 107 PREEMPTIBLE_HANDLER exc_dispatch 102 108 … … 106 112 fp_disabled_tl0: 107 113 mov TT_FP_DISABLED, %g2 114 clr %g5 108 115 PREEMPTIBLE_HANDLER exc_dispatch 109 116 … … 113 120 fp_exception_ieee_754_tl0: 114 121 mov TT_FP_EXCEPTION_IEEE_754, %g2 122 clr %g5 115 123 PREEMPTIBLE_HANDLER exc_dispatch 116 124 … … 120 128 fp_exception_other_tl0: 121 129 mov TT_FP_EXCEPTION_OTHER, %g2 130 clr %g5 122 131 PREEMPTIBLE_HANDLER exc_dispatch 123 132 … … 127 136 tag_overflow_tl0: 128 137 mov TT_TAG_OVERFLOW, %g2 138 clr %g5 129 139 PREEMPTIBLE_HANDLER exc_dispatch 130 140 … … 140 150 division_by_zero_tl0: 141 151 mov TT_DIVISION_BY_ZERO, %g2 152 clr %g5 142 153 PREEMPTIBLE_HANDLER exc_dispatch 143 154 … … 148 159 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 149 160 mov TT_DATA_ACCESS_EXCEPTION, %g2 161 clr %g5 150 162 PREEMPTIBLE_HANDLER exc_dispatch 151 163 … … 155 167 data_access_error_tl0: 156 168 mov TT_DATA_ACCESS_ERROR, %g2 169 clr %g5 157 170 PREEMPTIBLE_HANDLER exc_dispatch 158 171 … … 162 175 mem_address_not_aligned_tl0: 163 176 mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2 177 clr %g5 164 178 PREEMPTIBLE_HANDLER exc_dispatch 165 179 … … 169 183 LDDF_mem_address_not_aligned_tl0: 170 184 mov TT_LDDF_MEM_ADDRESS_NOT_ALIGNED, %g2 185 clr %g5 171 186 PREEMPTIBLE_HANDLER exc_dispatch 172 187 … … 176 191 STDF_mem_address_not_aligned_tl0: 177 192 mov TT_STDF_MEM_ADDRESS_NOT_ALIGNED, %g2 193 clr %g5 178 194 PREEMPTIBLE_HANDLER exc_dispatch 179 195 … … 183 199 privileged_action_tl0: 184 200 mov TT_PRIVILEGED_ACTION, %g2 201 clr %g5 185 202 PREEMPTIBLE_HANDLER exc_dispatch 186 203 … … 190 207 LDQF_mem_address_not_aligned_tl0: 191 208 mov TT_LDQF_MEM_ADDRESS_NOT_ALIGNED, %g2 209 clr %g5 192 210 PREEMPTIBLE_HANDLER exc_dispatch 193 211 … … 197 215 STQF_mem_address_not_aligned_tl0: 198 216 mov TT_STQF_MEM_ADDRESS_NOT_ALIGNED, %g2 217 clr %g5 199 218 PREEMPTIBLE_HANDLER exc_dispatch 200 219 … … 204 223 interrupt_level_1_handler_tl0: 205 224 mov TT_INTERRUPT_LEVEL_1, %g2 225 clr %g5 206 226 PREEMPTIBLE_HANDLER exc_dispatch 207 227 … … 211 231 interrupt_level_2_handler_tl0: 212 232 mov TT_INTERRUPT_LEVEL_2, %g2 233 clr %g5 213 234 PREEMPTIBLE_HANDLER exc_dispatch 214 235 … … 218 239 interrupt_level_3_handler_tl0: 219 240 mov TT_INTERRUPT_LEVEL_3, %g2 241 clr %g5 220 242 PREEMPTIBLE_HANDLER exc_dispatch 221 243 … … 225 247 interrupt_level_4_handler_tl0: 226 248 mov TT_INTERRUPT_LEVEL_4, %g2 249 clr %g5 227 250 PREEMPTIBLE_HANDLER exc_dispatch 228 251 … … 232 255 interrupt_level_5_handler_tl0: 233 256 mov TT_INTERRUPT_LEVEL_5, %g2 257 clr %g5 234 258 PREEMPTIBLE_HANDLER exc_dispatch 235 259 … … 239 263 interrupt_level_6_handler_tl0: 240 264 mov TT_INTERRUPT_LEVEL_6, %g2 265 clr %g5 241 266 PREEMPTIBLE_HANDLER exc_dispatch 242 267 … … 246 271 interrupt_level_7_handler_tl0: 247 272 mov TT_INTERRUPT_LEVEL_7, %g2 273 clr %g5 248 274 PREEMPTIBLE_HANDLER exc_dispatch 249 275 … … 253 279 interrupt_level_8_handler_tl0: 254 280 mov TT_INTERRUPT_LEVEL_8, %g2 281 clr %g5 255 282 PREEMPTIBLE_HANDLER exc_dispatch 256 283 … … 260 287 interrupt_level_9_handler_tl0: 261 288 mov TT_INTERRUPT_LEVEL_9, %g2 289 clr %g5 262 290 PREEMPTIBLE_HANDLER exc_dispatch 263 291 … … 267 295 interrupt_level_10_handler_tl0: 268 296 mov TT_INTERRUPT_LEVEL_10, %g2 297 clr %g5 269 298 PREEMPTIBLE_HANDLER exc_dispatch 270 299 … … 274 303 interrupt_level_11_handler_tl0: 275 304 mov TT_INTERRUPT_LEVEL_11, %g2 305 clr %g5 276 306 PREEMPTIBLE_HANDLER exc_dispatch 277 307 … … 281 311 interrupt_level_12_handler_tl0: 282 312 mov TT_INTERRUPT_LEVEL_12, %g2 313 clr %g5 283 314 PREEMPTIBLE_HANDLER exc_dispatch 284 315 … … 288 319 interrupt_level_13_handler_tl0: 289 320 mov TT_INTERRUPT_LEVEL_13, %g2 321 clr %g5 290 322 PREEMPTIBLE_HANDLER exc_dispatch 291 323 … … 295 327 interrupt_level_14_handler_tl0: 296 328 mov TT_INTERRUPT_LEVEL_14, %g2 329 clr %g5 297 330 PREEMPTIBLE_HANDLER exc_dispatch 298 331 … … 302 335 interrupt_level_15_handler_tl0: 303 336 mov TT_INTERRUPT_LEVEL_15, %g2 337 clr %g5 304 338 PREEMPTIBLE_HANDLER exc_dispatch 305 339 … … 309 343 interrupt_vector_trap_handler_tl0: 310 344 mov TT_INTERRUPT_VECTOR_TRAP, %g2 345 clr %g5 311 346 PREEMPTIBLE_HANDLER exc_dispatch 312 347 … … 377 412 .global trap_instruction_\cur\()_tl0 378 413 trap_instruction_\cur\()_tl0: 414 mov \cur, %g2 379 415 ba %xcc, trap_instruction_handler 380 mov \cur, %g2416 clr %g5 381 417 .endr 382 418 … … 392 428 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 393 429 mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2 430 clr %g5 394 431 PREEMPTIBLE_HANDLER exc_dispatch 395 432 … … 400 437 wrpr %g0, 1, %tl 401 438 mov TT_INSTRUCTION_ACCESS_ERROR, %g2 439 clr %g5 402 440 PREEMPTIBLE_HANDLER exc_dispatch 403 441 … … 408 446 wrpr %g0, 1, %tl 409 447 mov TT_ILLEGAL_INSTRUCTION, %g2 448 clr %g5 410 449 PREEMPTIBLE_HANDLER exc_dispatch 411 450 … … 422 461 wrpr %g0, 1, %tl 423 462 mov TT_DIVISION_BY_ZERO, %g2 463 clr %g5 424 464 PREEMPTIBLE_HANDLER exc_dispatch 425 465 … … 431 471 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 432 472 mov TT_DATA_ACCESS_EXCEPTION, %g2 473 clr %g5 433 474 PREEMPTIBLE_HANDLER exc_dispatch 434 475 … … 439 480 wrpr %g0, 1, %tl 440 481 mov TT_DATA_ACCESS_ERROR, %g2 482 clr %g5 441 483 PREEMPTIBLE_HANDLER exc_dispatch 442 484 … … 447 489 wrpr %g0, 1, %tl 448 490 mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2 491 clr %g5 449 492 PREEMPTIBLE_HANDLER exc_dispatch 450 493 … … 512 555 * %g1 Address of function to call if this is not a syscall. 513 556 * %g2 First argument for the function. 557 * %g5 I/DTLB_TAG_ACCESS register if applicable. 514 558 * %g6 Pre-set as kernel stack base if trap from userspace. 515 559 * %g7 Pre-set as address of the userspace window buffer. 516 560 */ 517 561 .macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall 518 /*519 * ASSERT(%tl == 1)520 */521 rdpr %tl, %g3522 cmp %g3, 1523 be %xcc, 1f524 nop525 ! this is for debugging, if we ever get here it will be easy to find526 0: ba,a %xcc, 0b527 528 1:529 562 .if NOT(\is_syscall) 530 563 rdpr %tstate, %g3 … … 544 577 bnz %xcc, 0f ! ...skip setting of kernel stack and primary context 545 578 nop 546 547 579 .endif 580 548 581 /* 549 582 * Normal window spills will go to the userspace window buffer. … … 558 591 * and the new window's %fp. 559 592 */ 560 save %g6, - PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp593 save %g6, -ISTATE_SIZE, %sp 561 594 562 595 .if \is_syscall … … 590 623 ba,a %xcc, 1f 591 624 0: 592 save %sp, - PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp625 save %sp, -ISTATE_SIZE, %sp 593 626 594 627 /* … … 612 645 .else 613 646 ! store the syscall number on the stack as 7th argument 614 stx %g2, [%sp + STACK_ WINDOW_SAVE_AREA_SIZE + STACK_BIAS + STACK_ARG6]647 stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_ARG6] 615 648 .endif 616 649 617 650 /* 618 * Save TSTATE, TPC and TNPCaside.651 * Save TSTATE, TPC, TNPC and I/DTLB_TAG_ACCESS aside. 619 652 */ 620 653 rdpr %tstate, %g1 … … 623 656 rd %y, %g4 624 657 625 stx %g1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE] 626 stx %g2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC] 627 stx %g3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC] 658 stx %g1, [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE] 659 stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_TPC] 660 stx %g3, [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC] 661 stx %g5, [%sp + STACK_BIAS + ISTATE_OFFSET_TLB_TAG_ACCESS] 628 662 629 663 /* 630 664 * Save the Y register. 631 * This register is deprecated according to SPARC V9 specification 632 * and is only present for backward compatibility with previous 633 * versions of the SPARC architecture. 634 * Surprisingly, gcc makes use of this register without a notice. 635 */ 636 stx %g4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_Y] 665 */ 666 stx %g4, [%sp + STACK_BIAS + ISTATE_OFFSET_Y] 637 667 638 668 wrpr %g0, 0, %tl … … 645 675 */ 646 676 call %l0 647 add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1677 add %sp, STACK_BIAS, %o1 648 678 .else 649 679 /* … … 663 693 * Read TSTATE, TPC and TNPC from saved copy. 664 694 */ 665 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE], %g1666 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC], %g2667 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC], %g3695 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE], %g1 696 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TPC], %g2 697 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC], %g3 668 698 669 699 /* … … 686 716 * Restore Y. 687 717 */ 688 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_Y], %g4718 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_Y], %g4 689 719 wr %g4, %y 690 720 … … 726 756 */ 727 757 mov %sp, %g2 728 stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0]729 stx %i1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1]730 stx %i2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2]731 stx %i3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3]732 stx %i4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4]733 stx %i5, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5]734 stx %i6, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6]735 stx %i7, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7]758 stx %i0, [%sp + STACK_BIAS + ISTATE_OFFSET_O0] 759 stx %i1, [%sp + STACK_BIAS + ISTATE_OFFSET_O1] 760 stx %i2, [%sp + STACK_BIAS + ISTATE_OFFSET_O2] 761 stx %i3, [%sp + STACK_BIAS + ISTATE_OFFSET_O3] 762 stx %i4, [%sp + STACK_BIAS + ISTATE_OFFSET_O4] 763 stx %i5, [%sp + STACK_BIAS + ISTATE_OFFSET_O5] 764 stx %i6, [%sp + STACK_BIAS + ISTATE_OFFSET_O6] 765 stx %i7, [%sp + STACK_BIAS + ISTATE_OFFSET_O7] 736 766 wrpr %l0, 0, %cwp 737 767 mov %g2, %sp 738 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0], %i0739 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1], %i1740 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2], %i2741 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3], %i3742 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4], %i4743 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5], %i5744 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6], %i6745 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7], %i7768 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O0], %i0 769 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O1], %i1 770 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O2], %i2 771 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O3], %i3 772 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O4], %i4 773 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O5], %i5 774 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O6], %i6 775 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O7], %i7 746 776 747 777 /*
Note:
See TracChangeset
for help on using the changeset viewer.