* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: ffu_fsr_tem_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 TRAP_TAKEN 0x1fff
#define TEM_INVALID_SHIFT 27
#define TEM_OVERFLOW_SHIFT 26
#define TEM_UNDERFLOW %o3
#define TEM_UNDERFLOW_SHIFT 25
#define TEM_DIV_0_SHIFT 24
#define TEM_INEXACT_SHIFT 23
#define H_T0_Fp_exception_ieee_754_0x21 trap_ieee754
#define MAIN_PAGE_HV_ALSO
#define MAIN_PAGE_NUCLEUS_ALSO
#define ENABLE_T0_Clean_Window_0x24
#define ENABLE_T0_Corrected_ECC_error_0x63
#define ENABLE_T0_Data_Access_Exception_0x30
#define ENABLE_T0_Data_access_error_0x32
#define ENABLE_T0_Division_By_Zero_0x28
#define ENABLE_T0_Fp_disabled_0x20
#define ENABLE_T0_Fp_exception_ieee_754_0x21
#define ENABLE_T0_Fp_exception_other_0x22
#define ENABLE_T0_Illegal_instruction_0x10
#define ENABLE_T0_Instruction_Access_MMU_Miss_0x09
#define ENABLE_T0_Instruction_access_error_0x0a
#define ENABLE_T0_Instruction_access_exception_0x08
#define ENABLE_T0_Lddf_Mem_Address_Not_Aligned_0x35
#define ENABLE_T0_Mem_Address_Not_Aligned_0x34
#define ENABLE_T0_Privileged_Action_0x37
#define ENABLE_T0_Privileged_opcode_0x11
#define ENABLE_T0_Stdf_Mem_Address_Not_Aligned_0x36
#define ENABLE_T0_Tag_Overflow_0x23
#define ENABLE_T0_Unimplemented_LDD_0x12
#define ENABLE_T0_Unimplemented_STD_0x13
#define ENABLE_T0_data_access_protection_0x6c
#define ENABLE_T0_fast_data_access_MMU_miss_0x68
#define ENABLE_T0_fast_instr_access_MMU_miss_0x64
th_fork(th_main,%l0) ! start up to four threads.
ldd [OPERAND_P+0x10], %f4
ldd [OPERAND_P+0x18], %f6
ldd [OPERAND_P+0x20], %f8
ldd [OPERAND_P+0x28], %f10
ldd [OPERAND_P+0x30], %f12
ldd [OPERAND_P+0x38], %f14
ldd [OPERAND_P+0x40], %f16
ldd [OPERAND_P+0x48], %f18
! clear destination regs because they are unchanged on a trap
! set register values for checking TEM settings
sll %l1,TEM_INVALID_SHIFT,TEM_INVALID
sll %l1,TEM_OVERFLOW_SHIFT,TEM_OVERFLOW
sll %l1,TEM_UNDERFLOW_SHIFT,TEM_UNDERFLOW
sll %l1,TEM_DIV_0_SHIFT,TEM_DIV_0
sll %l1,TEM_INEXACT_SHIFT,TEM_INEXACT
st %fsr,[FSR_DUMP_P] ! double check that st %fsr does not
ld [FSR_DUMP_P],%l2 ! clear wrong fields
add %g0,TRAP_NOT_TAKEN,%g6
fdivd %f0,%f2,%f20 ! 0/0 is invalid
brz %g5,overflow ! ok if trap was not enabled
brnz %g6,overflow ! ok if trap was taken
add %g0,TRAP_NOT_TAKEN,%g6
fdivd %f4,%f6,%f22 ! big/tiny overflows
brz %g5,underflow ! ok if trap was not enabled
brnz %g6,underflow ! ok if trap was taken
add %g0,TRAP_NOT_TAKEN,%g6
fdivd %f8,%f10,%f24 ! tiny/big underflows
and %g5,TEM_UNDERFLOW,%g5
brz %g5,div0 ! ok if trap was not enabled
brnz %g6,div0 ! ok if trap was taken
add %g0,TRAP_NOT_TAKEN,%g6
fdivd %f12,%f14,%f26 ! x/0 is div by zero if x <> 0
brz %g5,inexact ! ok if trap was not enabled
brnz %g6,inexact ! ok if trap was taken
add %g0,TRAP_NOT_TAKEN,%g6
faddd %f16,%f18,%f28 ! must round, therefore inexact
brz %g5,next_case ! ok if trap was not enabled
brnz %g6,next_case ! ok if trap was taken
sub %i7, 1, %i7 ! next mode
!==========================
.word 0x00000000, 0x00000000 ! fsr_invalid (nvc/nva)
.word 0x00000000, 0x00000000
.word 0x7fe88888, 0x00000000 ! fsr_overflow (ofc/ofa)
.word 0x05290000, 0x00001230
.word 0x003f3000, 0x00000000 ! fsr_underflow (ufc/ufa)
.word 0x66699999, 0x00000000
.word 0x02080000, 0x00000000 ! fsr_division by zero (dzc/dza)
.word 0x00000000, 0x00000000
.word 0x3fefffff, 0xfffffffd ! fsr_inexact (nxc/nxa)
.word 0x3fefffff, 0xfffffffe
// User %g6 lets test loop know that the trap was hit.
wrpr %g0,0,%gl ! go back to GL=0