| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: exu_irf_local_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 NUM_WINDOWS 8 |
| 39 | #define NUM_PATTERNS 35 |
| 40 | |
| 41 | #define MAIN_PAGE_HV_ALSO |
| 42 | #define MAIN_PAGE_NUCLEUS_ALSO |
| 43 | #include "hboot.s" |
| 44 | |
| 45 | .global main |
| 46 | main: |
| 47 | th_fork(th_main,%l0) ! start up to four threads. |
| 48 | ! No need to run more than one core. |
| 49 | ! All threads do the same thing, except for this one bit of setup... |
| 50 | th_main_0: |
| 51 | th_main_1: |
| 52 | th_main_2: |
| 53 | th_main_3: |
| 54 | |
| 55 | ! the code has already been through the boot code, so we know the registers |
| 56 | ! are not too badly broken |
| 57 | |
| 58 | |
| 59 | ta T_CHANGE_PRIV |
| 60 | wrpr %g0,0,%gl ! GL=0, just to be sure |
| 61 | wrpr %g0,0,%cwp ! CWP = 0 for register window test next.. |
| 62 | wrpr %g0,0,%wstate |
| 63 | ta T_CHANGE_NONPRIV |
| 64 | |
| 65 | !************************************ |
| 66 | ! Locals (%i,%l,%o), trap level 0 |
| 67 | !************************************ |
| 68 | setx lz,%l0,%g1 |
| 69 | add %g0,0,%g4 |
| 70 | locals_wins_loop: |
| 71 | ! for %cwp=0 to 7, check %r8-%r31. For %i and %o, check them with half |
| 72 | ! the data, but do use both names so that problems in the ACTIVE |
| 73 | ! buffer would be seen. |
| 74 | setx pattern_start,%l0,%g2 |
| 75 | add %g0,NUM_PATTERNS,%g3 |
| 76 | loop_locals: |
| 77 | ldx [%g2],%i0 |
| 78 | mova %icc,%i0,%i1 |
| 79 | mova %icc,%i1,%i2 |
| 80 | mova %icc,%i2,%i3 |
| 81 | mova %icc,%i3,%i4 |
| 82 | mova %icc,%i4,%i5 |
| 83 | mova %icc,%i5,%i6 |
| 84 | mova %icc,%i6,%i7 |
| 85 | |
| 86 | mova %icc,%i0,%l0 |
| 87 | mova %icc,%l0,%l1 |
| 88 | mova %icc,%l1,%l2 |
| 89 | mova %icc,%l2,%l3 |
| 90 | mova %icc,%l3,%l4 |
| 91 | mova %icc,%l4,%l5 |
| 92 | mova %icc,%l5,%l6 |
| 93 | mova %icc,%l6,%l7 |
| 94 | |
| 95 | xor %i0,0x1fff,%o0 |
| 96 | xor %i1,0x1fff,%o1 |
| 97 | xor %i2,0x1fff,%o2 |
| 98 | xor %i3,0x1fff,%o3 |
| 99 | xor %i4,0x1fff,%o4 |
| 100 | xor %i5,0x1fff,%o5 |
| 101 | xor %i6,0x1fff,%o6 |
| 102 | xor %i7,0x1fff,%o7 |
| 103 | |
| 104 | xor %l0,0x1fff,%l0 |
| 105 | xor %l1,0x1fff,%l1 |
| 106 | xor %l2,0x1fff,%l2 |
| 107 | xor %l3,0x1fff,%l3 |
| 108 | xor %l4,0x1fff,%l4 |
| 109 | xor %l5,0x1fff,%l5 |
| 110 | xor %l6,0x1fff,%l6 |
| 111 | xor %l7,0x1fff,%l7 |
| 112 | |
| 113 | sub %g3,1,%g3 |
| 114 | brgz %g3,loop_locals ! next data pattern |
| 115 | add %g2,8,%g2 |
| 116 | |
| 117 | ! next register window |
| 118 | add %g4,1,%g4 |
| 119 | ta T_CHANGE_PRIV |
| 120 | wrpr %g4,0,%cwp |
| 121 | ta T_CHANGE_NONPRIV |
| 122 | subcc %g4,NUM_WINDOWS,%g0 |
| 123 | bneg locals_wins_loop |
| 124 | nop |
| 125 | |
| 126 | good_end: |
| 127 | ta T_GOOD_TRAP |
| 128 | nop |
| 129 | nop |
| 130 | |
| 131 | bad_end: |
| 132 | ta T_BAD_TRAP |
| 133 | nop |
| 134 | nop |
| 135 | |
| 136 | !========================== |
| 137 | .data |
| 138 | .align 0x1fff+1 |
| 139 | |
| 140 | pattern_start: |
| 141 | .word 0xaaaaaaaa, 0xaaaaaaaa |
| 142 | .word 0x00000000, 0x00000000 |
| 143 | .word 0xffffffff, 0x00000001 |
| 144 | .word 0x7fffffff, 0x00000002 |
| 145 | .word 0xfffffffe, 0x00000004 |
| 146 | .word 0xbfffffff, 0x00000008 |
| 147 | .word 0xfffffffd, 0x00000010 |
| 148 | .word 0xdfffffff, 0x00000020 |
| 149 | .word 0xfffffffb, 0x00000040 |
| 150 | .word 0xefffffff, 0x00000080 |
| 151 | .word 0xfffffff7, 0x00000100 |
| 152 | .word 0xf7ffffff, 0x00000200 |
| 153 | .word 0xffffffef, 0x00000400 |
| 154 | .word 0xfbffffff, 0x00000800 |
| 155 | .word 0xffffffdf, 0x00001000 |
| 156 | .word 0xfdffffff, 0x00002000 |
| 157 | .word 0xffffffbf, 0x00004000 |
| 158 | .word 0xfeffffff, 0x00008000 |
| 159 | .word 0xffffff7f, 0x00010000 |
| 160 | .word 0xff7fffff, 0x00020000 |
| 161 | .word 0xfffffeff, 0x00040000 |
| 162 | .word 0xffbfffff, 0x00080000 |
| 163 | .word 0xfffffdff, 0x00100000 |
| 164 | .word 0xffdfffff, 0x00200000 |
| 165 | .word 0xfffffbff, 0x00400000 |
| 166 | .word 0xffefffff, 0x00800000 |
| 167 | .word 0xfffff7ff, 0x01000000 |
| 168 | .word 0xfff7ffff, 0x02000000 |
| 169 | .word 0xffffefff, 0x04000000 |
| 170 | .word 0xfffbffff, 0x08000000 |
| 171 | .word 0xffffdfff, 0x10000000 |
| 172 | .word 0xfffdffff, 0x20000000 |
| 173 | .word 0xffffbfff, 0x40000000 |
| 174 | .word 0xfffeffff, 0x80000000 |
| 175 | .word 0xffff7fff, 0x00000000 |
| 176 | |
| 177 | lz: .space 256,0 ! storage area |
| 178 | |
| 179 | |
| 180 | |
| 181 | .end |