* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: traps_save_restore.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 MAIN_PAGE_NUCLEUS_ALSO
#define MAIN_PAGE_HV_ALSO
#define MY_GENERIC_TRAP \
#define H_T0_Window_Spill_0_Normal_Trap
#define My_T0_Window_Spill_0_Normal_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_1_Normal_Trap
#define My_T0_Window_Spill_1_Normal_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_2_Normal_Trap
#define My_T0_Window_Spill_2_Normal_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_3_Normal_Trap
#define My_T0_Window_Spill_3_Normal_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_4_Normal_Trap
#define My_T0_Window_Spill_4_Normal_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_5_Normal_Trap
#define My_T0_Window_Spill_5_Normal_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_6_Normal_Trap
#define My_T0_Window_Spill_6_Normal_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_7_Normal_Trap
#define My_T0_Window_Spill_7_Normal_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_0_Other_Trap
#define My_T0_Window_Spill_0_Other_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_1_Other_Trap
#define My_T0_Window_Spill_1_Other_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_2_Other_Trap
#define My_T0_Window_Spill_2_Other_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_3_Other_Trap
#define My_T0_Window_Spill_3_Other_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_4_Other_Trap
#define My_T0_Window_Spill_4_Other_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_5_Other_Trap
#define My_T0_Window_Spill_5_Other_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_6_Other_Trap
#define My_T0_Window_Spill_6_Other_Trap MY_SPILL_TRAP
#define H_T0_Window_Spill_7_Other_Trap
#define My_T0_Window_Spill_7_Other_Trap MY_SPILL_TRAP
#define H_T0_Window_Fill_0_Normal_Trap
#define My_T0_Window_Fill_0_Normal_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_1_Normal_Trap
#define My_T0_Window_Fill_1_Normal_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_2_Normal_Trap
#define My_T0_Window_Fill_2_Normal_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_3_Normal_Trap
#define My_T0_Window_Fill_3_Normal_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_4_Normal_Trap
#define My_T0_Window_Fill_4_Normal_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_5_Normal_Trap
#define My_T0_Window_Fill_5_Normal_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_6_Normal_Trap
#define My_T0_Window_Fill_6_Normal_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_7_Normal_Trap
#define My_T0_Window_Fill_7_Normal_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_0_Other_Trap
#define My_T0_Window_Fill_0_Other_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_1_Other_Trap
#define My_T0_Window_Fill_1_Other_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_2_Other_Trap
#define My_T0_Window_Fill_2_Other_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_3_Other_Trap
#define My_T0_Window_Fill_3_Other_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_4_Other_Trap
#define My_T0_Window_Fill_4_Other_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_5_Other_Trap
#define My_T0_Window_Fill_5_Other_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_6_Other_Trap
#define My_T0_Window_Fill_6_Other_Trap MY_FILL_TRAP
#define H_T0_Window_Fill_7_Other_Trap
#define My_T0_Window_Fill_7_Other_Trap MY_FILL_TRAP
#define H_T0_Clean_Window
#define My_T0_Clean_Window MY_GENERIC_TRAP
/************************************************************************
************************************************************************/
ta T_CHANGE_PRIV ! run in priv mode
! rdth_id ! get thread ID in %o1
! setx user_data_start, %g1, %g3
wrpr %g0, %cwp ! default window is zero
setx HV_TRAP_BASE_PA, %g1, %i7
srlx %i7, 13, %i4 ! HV_TRAP_BASE
setx TRAP_BASE_VA, %g1, %i7
srlx %i7, 13, %i5 ! TRAP_BASE
wrpr %g7, %wstate ! what trap we will take
wrpr %g0, %cansave ! can't save
wrpr %g0, %cwp ! default window is zero
!%o0 = itteration X 4 + 80 + 20 if other = TrapType
srlx %l4, 13, %g3 ! table address
cmp %g3, %i5 ! correct table used by tlu?
! If CANSAVE 0, the SAVE instruction checks whether the new window
! needs to be cleaned. It causes a clean_windowtrap if the number of
! unused clean windows is zero, that is, (CLEANWIN - CANRESTORE)
! = 0. The clean_window trap handler is invoked with the CWP set to
! point to the window to be cleaned (that is, old CWP + 1).
wrpr %g0, %cwp ! default window is zero
! wrpr %g0, %wstate ! what trap we will take
wrpr %g1, %cansave ! can save
save %g1, %g1, %g1! do it
wrpr %g0, %cwp ! default window is zero
cmp %l5, 0x24 !type check
srlx %l4, 13, %g3 ! table address
cmp %g3, %i5 ! correct table used by tlu?
wrpr %g0, %cwp ! default window is zero
wrpr %g7, %wstate ! what trap we will take
wrpr %g0, %canrestore ! can't restore
wrpr %g0, %cwp ! default window is zero
!%o0 = itteration X 4 + C0 + 20 if other = TrapType
srlx %l4, 13, %g3 ! table address
cmp %g3, %i5 ! correct table used by tlu?
/************************************************************************
************************************************************************/
.xword 0xDEADBEEFDEADBEEF
.xword 0x1111111122222222
.xword 0x3333333344444444