Rev 1864 | Rev 1870 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1864 | Rev 1865 | ||
|---|---|---|---|
| Line 25... | Line 25... | ||
| 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 | * This file contains kernel trap table. |
31 | * @brief This file contains kernel trap table. |
| 31 | */ |
32 | */ |
| 32 | 33 | ||
| 33 | .register %g2, #scratch |
34 | .register %g2, #scratch |
| 34 | .register %g3, #scratch |
35 | .register %g3, #scratch |
| 35 | 36 | ||
| Line 82... | Line 83... | ||
| 82 | 83 | ||
| 83 | /* TT = 0x34, TL = 0, mem_address_not_aligned */ |
84 | /* TT = 0x34, TL = 0, mem_address_not_aligned */ |
| 84 | .org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE |
85 | .org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE |
| 85 | .global mem_address_not_aligned |
86 | .global mem_address_not_aligned |
| 86 | mem_address_not_aligned: |
87 | mem_address_not_aligned: |
| 87 | PREEMPTIBLE_HANDLER do_mem_address_not_aligned |
88 | MEM_ADDRESS_NOT_ALIGNED_HANDLER |
| 88 | 89 | ||
| 89 | /* TT = 0x41, TL = 0, interrupt_level_1 handler */ |
90 | /* TT = 0x41, TL = 0, interrupt_level_1 handler */ |
| 90 | .org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE |
91 | .org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE |
| 91 | .global interrupt_level_1_handler |
92 | .global interrupt_level_1_handler |
| 92 | interrupt_level_1_handler: |
93 | interrupt_level_1_handler: |
| Line 458... | Line 459... | ||
| 458 | 459 | ||
| 459 | /* TT = 0x34, TL > 0, mem_address_not_aligned */ |
460 | /* TT = 0x34, TL > 0, mem_address_not_aligned */ |
| 460 | .org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE |
461 | .org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE |
| 461 | .global mem_address_not_aligned_high |
462 | .global mem_address_not_aligned_high |
| 462 | mem_address_not_aligned_high: |
463 | mem_address_not_aligned_high: |
| 463 | PREEMPTIBLE_HANDLER do_mem_address_not_aligned |
464 | MEM_ADDRESS_NOT_ALIGNED_HANDLER |
| 464 | 465 | ||
| 465 | /* TT = 0x64, TL > 0, fast_instruction_access_MMU_miss */ |
466 | /* TT = 0x64, TL > 0, fast_instruction_access_MMU_miss */ |
| 466 | .org trap_table + (TT_FAST_INSTRUCTION_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
467 | .org trap_table + (TT_FAST_INSTRUCTION_ACCESS_MMU_MISS+512)*ENTRY_SIZE |
| 467 | .global fast_instruction_access_mmu_miss_handler_high |
468 | .global fast_instruction_access_mmu_miss_handler_high |
| 468 | fast_instruction_access_mmu_miss_handler_high: |
469 | fast_instruction_access_mmu_miss_handler_high: |
| Line 522... | Line 523... | ||
| 522 | * %g2 First argument for the function. |
523 | * %g2 First argument for the function. |
| 523 | * %g6 Pre-set as kernel stack base if trap from userspace. |
524 | * %g6 Pre-set as kernel stack base if trap from userspace. |
| 524 | * %g7 Pre-set as address of the userspace window buffer. |
525 | * %g7 Pre-set as address of the userspace window buffer. |
| 525 | */ |
526 | */ |
| 526 | .macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall |
527 | .macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall |
| - | 528 | /* |
|
| - | 529 | * ASSERT(%tl == 1) |
|
| - | 530 | */ |
|
| - | 531 | rdpr %tl, %g3 |
|
| - | 532 | cmp %g3, 1 |
|
| - | 533 | be 1f |
|
| - | 534 | nop |
|
| - | 535 | 0: ba 0b ! this for debugging, if we ever get here |
|
| - | 536 | nop ! it will be easy to find |
|
| - | 537 | ||
| - | 538 | 1: |
|
| 527 | .if NOT(\is_syscall) |
539 | .if NOT(\is_syscall) |
| 528 | rdpr %tstate, %g3 |
540 | rdpr %tstate, %g3 |
| 529 | andcc %g3, TSTATE_PRIV_BIT, %g0 ! if this trap came from the privileged mode... |
541 | andcc %g3, TSTATE_PRIV_BIT, %g0 ! if this trap came from the privileged mode... |
| 530 | bnz 0f ! ...skip setting of kernel stack and primary context |
542 | bnz 0f ! ...skip setting of kernel stack and primary context |
| 531 | nop |
543 | nop |
| Line 533... | Line 545... | ||
| 533 | /* |
545 | /* |
| 534 | * Normal window spills will go to the userspace window buffer. |
546 | * Normal window spills will go to the userspace window buffer. |
| 535 | */ |
547 | */ |
| 536 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(2), %wstate |
548 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(2), %wstate |
| 537 | 549 | ||
| - | 550 | wrpr %g0, NWINDOW - 1, %cleanwin ! prevent unnecessary clean_window exceptions |
|
| - | 551 | ||
| 538 | /* |
552 | /* |
| 539 | * Switch to kernel stack. The old stack is |
553 | * Switch to kernel stack. The old stack is |
| 540 | * automatically saved in the old window's %sp |
554 | * automatically saved in the old window's %sp |
| 541 | * and the new window's %fp. |
555 | * and the new window's %fp. |
| 542 | */ |
556 | */ |
| Line 552... | Line 566... | ||
| 552 | mov %i3, %o5 |
566 | mov %i3, %o5 |
| 553 | .endif |
567 | .endif |
| 554 | 568 | ||
| 555 | /* |
569 | /* |
| 556 | * Mark the CANRESTORE windows as OTHER windows. |
570 | * Mark the CANRESTORE windows as OTHER windows. |
| 557 | * Set CLEANWIN to NWINDOW-1 so that clean_window traps do not occur. |
- | |
| 558 | */ |
571 | */ |
| 559 | rdpr %canrestore, %l0 |
572 | rdpr %canrestore, %l0 |
| 560 | wrpr %l0, %otherwin |
573 | wrpr %l0, %otherwin |
| 561 | wrpr %g0, %canrestore |
574 | wrpr %g0, %canrestore |
| 562 | wrpr %g0, NWINDOW - 1, %cleanwin |
- | |
| 563 | 575 | ||
| 564 | /* |
576 | /* |
| 565 | * Switch to primary context 0. |
577 | * Switch to primary context 0. |
| 566 | */ |
578 | */ |
| 567 | mov VA_PRIMARY_CONTEXT_REG, %l0 |
579 | mov VA_PRIMARY_CONTEXT_REG, %l0 |
| Line 724... | Line 736... | ||
| 724 | * Set primary context according to secondary context. |
736 | * Set primary context according to secondary context. |
| 725 | */ |
737 | */ |
| 726 | wr %g0, ASI_DMMU, %asi |
738 | wr %g0, ASI_DMMU, %asi |
| 727 | ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1 |
739 | ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1 |
| 728 | stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi |
740 | stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi |
| - | 741 | rd %pc, %g1 |
|
| 729 | flush %o7 |
742 | flush %g1 |
| 730 | 743 | ||
| 731 | rdpr %cwp, %g1 |
744 | rdpr %cwp, %g1 |
| 732 | rdpr %otherwin, %g2 |
745 | rdpr %otherwin, %g2 |
| 733 | 746 | ||
| 734 | /* |
747 | /* |