Rev 2071 | Rev 3463 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2071 | Rev 2610 | ||
---|---|---|---|
Line 641... | Line 641... | ||
641 | * TL2: preemptible trap handler did SAVE |
641 | * TL2: preemptible trap handler did SAVE |
642 | * TL3: spill handler touched the kernel stack |
642 | * TL3: spill handler touched the kernel stack |
643 | * TL4: hardware or software failure |
643 | * TL4: hardware or software failure |
644 | * |
644 | * |
645 | * Input registers: |
645 | * Input registers: |
646 | * %g1 Address of function to call. |
646 | * %g1 Address of function to call if this is not a syscall. |
647 | * %g2 First argument for the function. |
647 | * %g2 First argument for the function. |
648 | * %g6 Pre-set as kernel stack base if trap from userspace. |
648 | * %g6 Pre-set as kernel stack base if trap from userspace. |
649 | * %g7 Pre-set as address of the userspace window buffer. |
649 | * %g7 Pre-set as address of the userspace window buffer. |
650 | */ |
650 | */ |
651 | .macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall |
651 | .macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall |
Line 695... | Line 695... | ||
695 | 695 | ||
696 | .if \is_syscall |
696 | .if \is_syscall |
697 | /* |
697 | /* |
698 | * Copy arguments for the syscall to the new window. |
698 | * Copy arguments for the syscall to the new window. |
699 | */ |
699 | */ |
- | 700 | mov %i0, %o0 |
|
- | 701 | mov %i1, %o1 |
|
700 | mov %i0, %o2 |
702 | mov %i2, %o2 |
701 | mov %i1, %o3 |
703 | mov %i3, %o3 |
702 | mov %i2, %o4 |
704 | mov %i4, %o4 |
703 | mov %i3, %o5 |
705 | mov %i5, %o5 |
704 | .endif |
706 | .endif |
705 | 707 | ||
706 | /* |
708 | /* |
707 | * Mark the CANRESTORE windows as OTHER windows. |
709 | * Mark the CANRESTORE windows as OTHER windows. |
708 | */ |
710 | */ |
Line 738... | Line 740... | ||
738 | 740 | ||
739 | /* |
741 | /* |
740 | * Copy arguments. |
742 | * Copy arguments. |
741 | */ |
743 | */ |
742 | mov %g1, %l0 |
744 | mov %g1, %l0 |
- | 745 | .if NOT(\is_syscall) |
|
743 | mov %g2, %o0 |
746 | mov %g2, %o0 |
- | 747 | .else |
|
- | 748 | ! store the syscall number on the stack as 7th argument |
|
- | 749 | stx %g2, [%sp + STACK_WINDOW_SAVE_AREA_SIZE + STACK_BIAS + STACK_ARG6] |
|
- | 750 | .endif |
|
744 | 751 | ||
745 | /* |
752 | /* |
746 | * Save TSTATE, TPC and TNPC aside. |
753 | * Save TSTATE, TPC and TNPC aside. |
747 | */ |
754 | */ |
748 | rdpr %tstate, %g1 |
755 | rdpr %tstate, %g1 |
Line 765... | Line 772... | ||
765 | 772 | ||
766 | wrpr %g0, 0, %tl |
773 | wrpr %g0, 0, %tl |
767 | wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT, %pstate |
774 | wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT, %pstate |
768 | SAVE_GLOBALS |
775 | SAVE_GLOBALS |
769 | 776 | ||
- | 777 | .if NOT(\is_syscall) |
|
770 | /* |
778 | /* |
771 | * Call the higher-level handler and pass istate as second parameter. |
779 | * Call the higher-level handler and pass istate as second parameter. |
772 | */ |
780 | */ |
773 | call %l0 |
781 | call %l0 |
774 | add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1 |
782 | add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1 |
775 | - | ||
776 | .if \is_syscall |
783 | .else |
777 | /* |
784 | /* |
778 | * Copy the value returned by the syscall. |
785 | * Call the higher-level syscall handler. |
779 | */ |
786 | */ |
780 | mov %o0, %i0 |
787 | call syscall_handler |
- | 788 | nop |
|
- | 789 | mov %o0, %i0 ! copy the value returned by the syscall |
|
781 | .endif |
790 | .endif |
782 | 791 | ||
783 | RESTORE_GLOBALS |
792 | RESTORE_GLOBALS |
784 | rdpr %pstate, %l1 ! we must preserve the PEF bit |
793 | rdpr %pstate, %l1 ! we must preserve the PEF bit |
785 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |
794 | wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate |