| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: fp_fprs0_n2.s |
| 5 | * Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved |
| 6 | * 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
| 7 | * |
| 8 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; version 2 of the License. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | * |
| 23 | * For the avoidance of doubt, and except that if any non-GPL license |
| 24 | * choice is available it will apply instead, Sun elects to use only |
| 25 | * the General Public License version 2 (GPLv2) at this time for any |
| 26 | * software where a choice of GPL license versions is made |
| 27 | * available with the language indicating that GPLv2 or any later version |
| 28 | * may be used, or where a choice of which version of the GPL is applied is |
| 29 | * otherwise unspecified. |
| 30 | * |
| 31 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 32 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 33 | * have any questions. |
| 34 | * |
| 35 | * |
| 36 | * ========== Copyright Header End ============================================ |
| 37 | */ |
| 38 | #define H_T0_Fp_disabled_0x20 |
| 39 | #define My_T0_Fp_disabled_0x20 \ |
| 40 | rdpr %tstate, %i1; \ |
| 41 | rdpr %tt, %i1; \ |
| 42 | wr %g0, 0x4, %fprs; \ |
| 43 | rdpr %tpc, %i0; \ |
| 44 | rdpr %tnpc, %i1; \ |
| 45 | retry; \ |
| 46 | nop; nop; |
| 47 | |
| 48 | |
| 49 | #define ENABLE_T0_Fp_disabled_0x20 |
| 50 | #include "hboot.s" |
| 51 | |
| 52 | .global sam_fast_immu_miss |
| 53 | .global sam_fast_dmmu_miss |
| 54 | |
| 55 | .text |
| 56 | .global main |
| 57 | |
| 58 | main: |
| 59 | |
| 60 | setx data0, %l0, %l1 |
| 61 | setx data1, %l0, %l2 |
| 62 | |
| 63 | wr %g0, 0x4, %fprs ! Set fp enable |
| 64 | |
| 65 | ld [%l1+0x0], %f0 ! dl should be set |
| 66 | rd %fprs, %g1 |
| 67 | |
| 68 | ldd [%l2+0x0], %f32 ! du should be set |
| 69 | rd %fprs, %g1 |
| 70 | |
| 71 | wr %g0, 0x4, %fprs ! Clear dl and du |
| 72 | |
| 73 | ba,a tgt00 ! in the delay slot |
| 74 | ldd [%l1+0x8], %f32 |
| 75 | |
| 76 | tgt00: |
| 77 | |
| 78 | rd %fprs, %g1 |
| 79 | |
| 80 | subcc %g0, 0x1, %g0 ! This should set n and c |
| 81 | |
| 82 | be,a test_fail |
| 83 | ldd [%l1+0x8], %f32 ! |
| 84 | |
| 85 | rd %fprs, %g1 |
| 86 | |
| 87 | subcc %g0, 0x1, %g0 ! This should set n and c |
| 88 | |
| 89 | be,a test_fail |
| 90 | ldd [%l1+0x8], %f0 ! |
| 91 | |
| 92 | rd %fprs, %g1 |
| 93 | |
| 94 | bne,a tgt01 |
| 95 | wr %g0, 0x0, %fprs ! Clear dl and du |
| 96 | |
| 97 | tgt01: |
| 98 | |
| 99 | ldd [%l1+0x8], %f0 ! Should cause fp disabled trap |
| 100 | |
| 101 | rd %fprs, %g1 |
| 102 | |
| 103 | |
| 104 | /******************************************************* |
| 105 | * Exit code |
| 106 | *******************************************************/ |
| 107 | |
| 108 | test_pass: |
| 109 | ta T_GOOD_TRAP |
| 110 | |
| 111 | test_fail: |
| 112 | ta T_BAD_TRAP |
| 113 | |
| 114 | /******************************************************* |
| 115 | * Data section |
| 116 | *******************************************************/ |
| 117 | |
| 118 | .data |
| 119 | |
| 120 | data0: |
| 121 | .word 0x80000010 |
| 122 | .word 0x80000011 |
| 123 | .word 0x80000012 |
| 124 | .word 0x80000013 |
| 125 | .word 0x80000014 |
| 126 | .word 0x80000015 |
| 127 | .word 0x80000016 |
| 128 | .word 0x80000017 |
| 129 | .word 0x80000018 |
| 130 | .word 0x80000019 |
| 131 | .word 0x8000001a |
| 132 | .word 0x8000001b |
| 133 | .word 0x8000001c |
| 134 | .word 0x8000001d |
| 135 | .word 0x8000001e |
| 136 | .word 0x8000001f |
| 137 | |
| 138 | .align 256 |
| 139 | |
| 140 | data1: |
| 141 | .word 0x00000011 |
| 142 | .word 0x00000012 |
| 143 | .word 0x00000013 |
| 144 | .word 0x00000014 |
| 145 | |
| 146 | |