* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: exu_win_traps_8th_n2.s
* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For the avoidance of doubt, and except that if any non-GPL license
* choice is available it will apply instead, Sun elects to use only
* the General Public License version 2 (GPLv2) at this time for any
* software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later version
* may be used, or where a choice of which version of the GPL is applied is
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* ========== Copyright Header End ============================================
#define H_VERSION_MAXWIN_MASK 0x1f
! communication betweent the test loop and the trap handlers.
#define TRAP_TAKEN 0x1fff
#define H_T0_Clean_Window trap_clean
#define H_T0_Window_Spill_0_Normal_Trap trap_spill
#define H_T0_Window_Spill_1_Normal_Trap trap_spill
#define H_T0_Window_Spill_2_Normal_Trap trap_spill
#define H_T0_Window_Spill_3_Normal_Trap trap_spill
#define H_T0_Window_Spill_4_Normal_Trap trap_spill
#define H_T0_Window_Spill_5_Normal_Trap trap_spill
#define H_T0_Window_Spill_6_Normal_Trap trap_spill
#define H_T0_Window_Spill_7_Normal_Trap trap_spill
#define H_T0_Window_Spill_0_Other_Trap trap_spill
#define H_T0_Window_Spill_1_Other_Trap trap_spill
#define H_T0_Window_Spill_2_Other_Trap trap_spill
#define H_T0_Window_Spill_3_Other_Trap trap_spill
#define H_T0_Window_Spill_4_Other_Trap trap_spill
#define H_T0_Window_Spill_5_Other_Trap trap_spill
#define H_T0_Window_Spill_6_Other_Trap trap_spill
#define H_T0_Window_Spill_7_Other_Trap trap_spill
#define H_T0_Window_Fill_0_Normal_Trap trap_fill
#define H_T0_Window_Fill_1_Normal_Trap trap_fill
#define H_T0_Window_Fill_2_Normal_Trap trap_fill
#define H_T0_Window_Fill_3_Normal_Trap trap_fill
#define H_T0_Window_Fill_4_Normal_Trap trap_fill
#define H_T0_Window_Fill_5_Normal_Trap trap_fill
#define H_T0_Window_Fill_6_Normal_Trap trap_fill
#define H_T0_Window_Fill_7_Normal_Trap trap_fill
#define H_T0_Window_Fill_0_Other_Trap trap_fill
#define H_T0_Window_Fill_1_Other_Trap trap_fill
#define H_T0_Window_Fill_2_Other_Trap trap_fill
#define H_T0_Window_Fill_3_Other_Trap trap_fill
#define H_T0_Window_Fill_4_Other_Trap trap_fill
#define H_T0_Window_Fill_5_Other_Trap trap_fill
#define H_T0_Window_Fill_6_Other_Trap trap_fill
#define H_T0_Window_Fill_7_Other_Trap trap_fill
/***********************************************************************/
#define MAIN_PAGE_HV_ALSO
#define MAIN_PAGE_NUCLEUS_ALSO
th_fork(th_main,%l0) ! start up to four threads.
! No need to run more than one core.
! All threads do the same thing, except for this one bit of setup...
! SAS mismatches on version reg...grumble grumble
!rdhpr %ver,%g4 ! get VERSION (NWINDOWS-1)
!and %g4,H_VERSION_MAXWIN_MASK,%g4
stx %g4,[%l1] ! save max_win value for later
!rdhpr %ver,%g4 ! get VERSION (NWINDOWS-1)
and %g4,H_VERSION_MAXWIN_MASK,%g4
stx %g4,[%l1] ! save max_win value for later
! place the window number, tid, and register number (r8-r23) in the local
! and out registers of each register window.
! Values in the form 00ttwwrr 00000000, ensure each register
! has a unique value. Lower half of register will be used as a counter.
sethi %hi(0x80000000),%g1
sllx %g1,4,%g1 ! base reg number in bits 39 to 32
or %l0,%g1,%g1 ! thread id in bits 55 to 48
sethi %hi(0x10000000),%g2
sllx %g2,4,%g2 ! reg increment
sllx %g3,40,%g3 ! window increment in bit 40
! read current CWP, CANRESTORE, just fyi.
! add one to CANSAVE to allow init of last window's regs
wrpr %g4,0,%cansave ! set CANSAVE = maxwin
save %g3,%g1,%g1 ! increment window field of g1, next window
!!*********************************************************************
!! save 1: OTHERWIN = 0, WSTATE.NORMAL=0
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g5,0,%cansave ! CANSAVE = maxwin-1
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
! add %l1,1,%l1 ! l1 and o1 are unpredictable for SAVE, so do not
! add %o1,1,%o1 ! mess with them. SAS will pick up rtl mismatch
!!*********************************************************************
!! save 2: OTHERWIN = 0, WSTATE.NORMAL=1
!!*********************************************************************
wrpr %g4,0,%cwp ! CWP = maxwin
wrpr %g0,3,%cansave ! CANSAVE = 3
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g5,0,%cleanwin ! CLEANWIN = maxwin-2
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 3: OTHERWIN = 0, WSTATE.NORMAL=2
!!*********************************************************************
wrpr %g5,0,%cwp ! CWP = maxwin-2
wrpr %g0,4,%cansave ! CANSAVE = 4
wrpr %g0,2,%canrestore ! CANRESTORE = 2
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 4: OTHERWIN = 0, WSTATE.NORMAL=3
!!*********************************************************************
wrpr %g0,1,%cwp ! CWP = 1
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g0,2,%cleanwin ! CLEANWIN = 2
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 5: OTHERWIN = 0, WSTATE.NORMAL=4
!!*********************************************************************
wrpr %g0,1,%cwp ! CWP = 1
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g0,2,%cleanwin ! CLEANWIN = 2
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 6: OTHERWIN = 0, WSTATE.NORMAL=5
!!*********************************************************************
wrpr %g5,0,%cwp ! CWP = maxwin-2
wrpr %g0,2,%cansave ! CANSAVE = 2
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g0,4,%cleanwin ! CLEANWIN = 4
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 7: OTHERWIN = 0, WSTATE.NORMAL=6
!!*********************************************************************
wrpr %g0,1,%cwp ! CWP = 1
wrpr %g0,2,%cansave ! CANSAVE = 2
wrpr %g0,4,%canrestore ! CANRESTORE = 0
wrpr %g0,7,%cleanwin ! CLEANWIN = 7
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 8: OTHERWIN = 0, WSTATE.NORMAL=7
!!*********************************************************************
wrpr %g4,0,%cwp ! CWP = maxwin
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g5,0,%cleanwin ! CLEANWIN = maxwin-2
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 9: OTHERWIN = 1, WSTATE.OTHER=0
!!*********************************************************************
wrpr %g5,0,%cwp ! CWP = maxwin-2
wrpr %g5,0,%cansave ! CANSAVE = maxwin-2
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 10: OTHERWIN = 1, WSTATE.OTHER=1
!!*********************************************************************
wrpr %g0,2,%cwp ! CWP = 2
wrpr %g0,3,%cansave ! CANSAVE = 3
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g0,5,%cleanwin ! CLEANWIN = 5
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 11: OTHERWIN = 1, WSTATE.OTHER=2
!!*********************************************************************
wrpr %g0,3,%cwp ! CWP = 3
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,2,%canrestore ! CANRESTORE = 2
wrpr %g0,4,%cleanwin ! CLEANWIN = 4
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 12: OTHERWIN = 1, WSTATE.OTHER=3
!!*********************************************************************
wrpr %g0,4,%cwp ! CWP = 4
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g0,3,%cleanwin ! CLEANWIN = 3
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 12: OTHERWIN = 1, WSTATE.OTHER=4
!!*********************************************************************
wrpr %g0,5,%cwp ! CWP = 5
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,3,%canrestore ! CANRESTORE = 3
wrpr %g0,7,%cleanwin ! CLEANWIN = 7
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 14: OTHERWIN = 1, WSTATE.OTHER=5
!!*********************************************************************
wrpr %g0,6,%cwp ! CWP = 6
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g0,4,%cleanwin ! CLEANWIN = 4
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 15: OTHERWIN = 1, WSTATE.OTHER=6
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g0,1,%cleanwin ! CLEANWIN = 1
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! save 16: OTHERWIN = 1, WSTATE.OTHER=7
!!*********************************************************************
wrpr %g4,0,%cwp ! CWP = maxwin
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g5,0,%canrestore ! CANRESTORE = maxwin-1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!!*********************************************************************
!! restore 0: OTHERWIN = 0, WSTATE.NORMAL=0
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g5,0,%canrestore ! CANRESTORE = maxwin-1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 1: OTHERWIN = 0, WSTATE.NORMAL=1
!!*********************************************************************
wrpr %g4,0,%cwp ! CWP = maxwin
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g0,0,%cleanwin ! CLEANWIN = 0
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 2: OTHERWIN = 0, WSTATE.NORMAL=2
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g0,3,%cleanwin ! CLEANWIN = 3
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 3: OTHERWIN = 0, WSTATE.NORMAL=3
!!*********************************************************************
wrpr %g0,2,%cwp ! CWP = 2
wrpr %g0,3,%cansave ! CANSAVE = 3
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 4: OTHERWIN = 0, WSTATE.NORMAL=4
!!*********************************************************************
wrpr %g0,1,%cwp ! CWP = 1
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,3,%canrestore ! CANRESTORE = 3
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 5: OTHERWIN = 0, WSTATE.NORMAL=5
!!*********************************************************************
wrpr %g5,0,%cwp ! CWP = maxwin-1
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,3,%canrestore ! CANRESTORE = 3
wrpr %g0,0,%cleanwin ! CLEANWIN = 0, not checked on restore
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 6: OTHERWIN = 0, WSTATE.NORMAL=6
!!*********************************************************************
wrpr %g4,0,%cwp ! CWP = maxwin
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 7: OTHERWIN = 0, WSTATE.NORMAL=7
!!*********************************************************************
wrpr %g4,0,%cwp ! CWP = maxwin
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 8: OTHERWIN = 1, WSTATE.OTHER=0
!!*********************************************************************
wrpr %g5,0,%cwp ! CWP = maxwin-1
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 9: OTHERWIN = 1, WSTATE.OTHER=1
!!*********************************************************************
wrpr %g0,3,%cwp ! CWP = 3
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 10: OTHERWIN = 1, WSTATE.OTHER=2
!!*********************************************************************
wrpr %g5,0,%cwp ! CWP = maxwin-1
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,2,%canrestore ! CANRESTORE = 2
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 11: OTHERWIN = 1, WSTATE.OTHER=3
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,2,%canrestore ! CANRESTORE = 2
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 12: OTHERWIN = 1, WSTATE.OTHER=4
!!*********************************************************************
wrpr %g0,2,%cwp ! CWP = 2
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,2,%canrestore ! CANRESTORE = 2
wrpr %g0,3,%cleanwin ! CLEANWIN = 3
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 13: OTHERWIN = 1, WSTATE.OTHER=5
!!*********************************************************************
wrpr %g0,4,%cwp ! CWP = 4
wrpr %g0,3,%cansave ! CANSAVE = 3
wrpr %g0,3,%canrestore ! CANRESTORE = 3
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 14: OTHERWIN = 1, WSTATE.OTHER=6
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,1,%cansave ! CANSAVE = 1
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!! restore 15: OTHERWIN = 1, WSTATE.OTHER=7
!!*********************************************************************
wrpr %g0,3,%cwp ! CWP = 3
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
add %g0,TRAP_NOT_TAKEN,%g6
restore %i0,1,%o0 ! effectively x++
add %i3,1,%i3 ! restore, all three regs blocks must match
!!*********************************************************************
!!*********************************************************************
!! clean1: cleanwin exception when cleanwin = canrestore = 0
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,3,%cansave ! CANSAVE = 3
wrpr %g0,0,%canrestore ! CANRESTORE = 0
wrpr %g0,0,%cleanwin ! CLEANWIN = 0
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! clean2: cleanwin exception when cleanwin = canrestore = 1
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,3,%cansave ! CANSAVE = 3
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g0,1,%cleanwin ! CLEANWIN = 1
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! clean3: save when cleanwin < canrestore. This is not architecturally
!! specified. Niagara will not trap.
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,3,%cansave ! CANSAVE = 3
wrpr %g0,2,%canrestore ! CANRESTORE = 2
wrpr %g0,1,%cleanwin ! CLEANWIN = 1
save %o0,1,%i0 ! effectively x++
!!*********************************************************************
!! clean4: save when cleanwin = canrestore, and cansave = 0.
!! the spill trap has priority over the cleanwin trap
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,3,%canrestore ! CANRESTORE = 3
wrpr %g0,3,%cleanwin ! CLEANWIN = 3
add %g0,TRAP_NOT_TAKEN,%g6
save %o0,1,%i0 ! effectively x++
!! trap clean does not use g6, so if g6 has changed, the correct trap
!! was taken. (Yeah, I know, this is not advertised as a self-checking
!!*********************************************************************
!!*********************************************************************
!! flush1: flush with NWINDOWS-2 = CANSAVE, should be a NOP
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g5,0,%cansave ! CANSAVE = maxwin-1 (NWINDOWS-2)
wrpr %g0,3,%canrestore ! CANRESTORE = 3
wrpr %g0,3,%cleanwin ! CLEANWIN = 3
add %g0,TRAP_NOT_TAKEN,%g6
!!*********************************************************************
!! flush2: flush with NWINDOWS-2-CANSAVE>0, should take a spill trap
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g5,0,%cansave ! CANSAVE = maxwin-3
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
wrpr %g0,0,%otherwin ! OTHERWIN = 0
add %g0,TRAP_NOT_TAKEN,%g6
!!*********************************************************************
!! flush3: flush with NWINDOWS-2<>CANSAVE, should take a spill trap
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g5,0,%cansave ! CANSAVE = maxwin-3
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
wrpr %g0,1,%otherwin ! OTHERWIN = 1
add %g0,TRAP_NOT_TAKEN,%g6
!!*********************************************************************
!! flush4: flush with NWINDOWS-2<>CANSAVE, should take a spill trap
!!*********************************************************************
wrpr %g4,0,%cwp ! CWP = maxwin
wrpr %g0,4,%cansave ! CANSAVE = 4
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g4,0,%cleanwin ! CLEANWIN = maxwin
wrpr %g0,0,%otherwin ! OTHERWIN = 0
add %g0,TRAP_NOT_TAKEN,%g6
!!*********************************************************************
!!*********************************************************************
!! saved/restored cases: all these instructions do is manipulate
!! cansave, canrestore, otherwin, and cleanwin values. No need
!! to actually use them in a trap handler.
!!*********************************************************************
wrpr %g0,0,%cwp ! CWP = 0
wrpr %g0,0,%cansave ! CANSAVE = 0
wrpr %g0,1,%canrestore ! CANRESTORE = 1
wrpr %g0,0,%cleanwin ! CLEANWIN = 0
wrpr %g0,0,%otherwin ! OTHERWIN = 0
restored ! eight in a row
wrpr %g4,0,%cansave ! CANSAVE = maxwin
wrpr %g4,0,%canrestore ! CANRESTORE = maxwin
wrpr %g0,3,%cleanwin ! CLEANWIN = 3
wrpr %g4,0,%otherwin ! OTHERWIN = maxwin
wrpr %g4,0,%otherwin ! OTHERWIN = maxwin
restored ! eight in a row
!==========================
/***********************************************************************/
//SECTION .CUST_TRAPS TEXT_VA=0x40000000, DATA_VA=0x41000000
// PA = ra2pa(0x40000000,0),
// part_0_i_ctx_zero_tsb_config_0,
// TTE_G=1, TTE_Context=0, TTE_V=1, TTE_Size=0, TTE_NFO=0, TTE_IE=0,
// TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, TTE_L=0, TTE_CP=1, TTE_CV=0,
// TTE_E=0, TTE_P=1, TTE_W=1
// PA = ra2pa(0x41000000,0),
// part_0_d_ctx_zero_tsb_config_0,
// TTE_G=1, TTE_Context=0, TTE_V=1, TTE_Size=0, TTE_NFO=0, TTE_IE=0,
// TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, TTE_L=0, TTE_CP=1, TTE_CV=0,
// TTE_E=0, TTE_P=1, TTE_W=1
// User %g7 is a parameter. if %g7=FINISH_DONE, use done, else use retry
// trap_clean DOES NOT modify the user %g6
wrpr %g0,0,%gl ! go back to GL=0, user global regs
wrpr %g0,1,%gl ! restore trap global regs
add %g6,1,%g6 ! cleanwin++
// User %g7 is a parameter. if %g7=FINISH_DONE, use done, else use retry
// User %g6 lets test loop know that the trap was hit.
wrpr %g0,0,%gl ! go back to GL=0
saved ! used by flushw test cases
// User %g7 is a parameter. if %g7=FINISH_DONE, use done, else use retry
// User %g6 lets test loop know that the trap was hit.
wrpr %g0,0,%gl ! go back to GL=0