| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: tso_n1_self_mod202.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 MAIN_BASE_DATA_ADDR 0x160000 |
| 39 | #define MAIN_BASE_TEXT_ADDR 0x150000 |
| 40 | #define MAIN_BASE_DATA_ADDR_RA 0x100160000 |
| 41 | #define MAIN_BASE_TEXT_ADDR_RA 0x100150000 |
| 42 | |
| 43 | #define USER_PAGE_CUSTOM_MAP |
| 44 | #include "hboot.s" |
| 45 | |
| 46 | SECTION .MAIN TEXT_VA=0x150000, DATA_VA=0x160000 |
| 47 | |
| 48 | attr_text { |
| 49 | Name = .MAIN, |
| 50 | VA=MAIN_BASE_TEXT_ADDR, |
| 51 | RA=MAIN_BASE_TEXT_ADDR_RA, |
| 52 | PA=ra2pa(MAIN_BASE_TEXT_ADDR_RA,0), |
| 53 | part_0_ctx_nonzero_tsb_config_1, |
| 54 | TTE_G=0, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, |
| 55 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, |
| 56 | TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_EP=1, TTE_P=0, TTE_W=1 |
| 57 | } |
| 58 | attr_data { |
| 59 | Name = .MAIN, |
| 60 | VA=MAIN_BASE_DATA_ADDR, |
| 61 | RA=MAIN_BASE_DATA_ADDR_RA, |
| 62 | PA=ra2pa(MAIN_BASE_DATA_ADDR_RA,0), |
| 63 | part_0_ctx_nonzero_tsb_config_1, |
| 64 | TTE_G=0, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, |
| 65 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, |
| 66 | TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1 |
| 67 | } |
| 68 | |
| 69 | .text |
| 70 | .global main |
| 71 | |
| 72 | main: clr %l0 |
| 73 | |
| 74 | add %g0, 0x20, %i3 ! loop counter |
| 75 | |
| 76 | main_loop: |
| 77 | clr %l1 |
| 78 | execute1: |
| 79 | set main1,%i0 |
| 80 | jmpl %i0,%o7 |
| 81 | nop |
| 82 | add %l1, %l0, %l1 |
| 83 | nop |
| 84 | nop |
| 85 | |
| 86 | modify1: |
| 87 | set main2,%i0 ! get some known data into the store reg. |
| 88 | set main1,%i1 ! change the data at main1 |
| 89 | ld [%i1],%l0 ! bring the data to D$ for testing |
| 90 | ld [%i0],%l0 |
| 91 | st %i1, [%i1] |
| 92 | cas [%i1], %i1, %l0 |
| 93 | flush %i1 |
| 94 | |
| 95 | execute2: |
| 96 | set main1,%i0 |
| 97 | jmpl %i0,%o7 !the jump causes a new cache line to be |
| 98 | nop !loaded into the ecache and the icache. |
| 99 | add %l1, %l0, %l1 |
| 100 | nop |
| 101 | nop |
| 102 | |
| 103 | modify2: |
| 104 | set main3,%i0 !get some known data into the store reg. |
| 105 | set main1,%i1 !change the data at main1 |
| 106 | ld [%i1],%l0 ! bring the data to D$ for testing |
| 107 | ld [%i0],%l0 |
| 108 | st %i1, [%i1] |
| 109 | cas [%i1], %i1, %l0 |
| 110 | flush %i1 |
| 111 | |
| 112 | execute3: |
| 113 | set main1,%i0 |
| 114 | jmpl %i0,%o7 !the jump causes a new cache line to be |
| 115 | nop !loaded into the ecache and the icache. |
| 116 | add %l1, %l0, %l1 |
| 117 | nop |
| 118 | nop |
| 119 | |
| 120 | modify3: |
| 121 | set main4,%i0 !get some known data into the store reg. |
| 122 | set main1,%i1 !change the data at main1 |
| 123 | ld [%i0],%l0 |
| 124 | st %i1, [%i1] |
| 125 | cas [%i1], %i1, %l0 |
| 126 | flush %i1 |
| 127 | |
| 128 | execute4: |
| 129 | set main1,%i0 |
| 130 | jmpl %i0,%o7 !the jump causes a new cache line to be |
| 131 | nop !loaded into the ecache and the icache. |
| 132 | add %l1, %l0, %l1 |
| 133 | nop |
| 134 | nop |
| 135 | |
| 136 | modify4: |
| 137 | set main5,%i0 !get some known data into the store reg. |
| 138 | set main1,%i1 !change the data at main1 |
| 139 | ld [%i0],%l0 |
| 140 | st %i1, [%i1] |
| 141 | cas [%i1], %i1, %l0 |
| 142 | flush %i1 |
| 143 | |
| 144 | execute5: |
| 145 | set main1,%i0 |
| 146 | jmpl %i0,%o7 !the jump causes a new cache line to be |
| 147 | nop !loaded into the ecache and the icache. |
| 148 | add %l1, %l0, %l1 |
| 149 | nop |
| 150 | nop |
| 151 | |
| 152 | set 15, %i0 |
| 153 | subcc %i0, %l1, %i0 |
| 154 | bnz bad_end |
| 155 | nop |
| 156 | |
| 157 | modify5: |
| 158 | set main6,%i0 !get some known data into the store reg. |
| 159 | set main1,%i1 !change the data at main1 |
| 160 | ld [%i1],%l0 ! bring the data to D$ for testing |
| 161 | ld [%i0],%l0 |
| 162 | st %l0,[%i1] |
| 163 | flush %i1 |
| 164 | |
| 165 | dec %i3 ! loop |
| 166 | brnz %i3, main_loop |
| 167 | nop |
| 168 | |
| 169 | normal_end: |
| 170 | ta T_GOOD_TRAP |
| 171 | bad_end: |
| 172 | ta T_BAD_TRAP |
| 173 | |
| 174 | |
| 175 | user_text_end: |
| 176 | |
| 177 | !-------------------------------------------------------------- |
| 178 | ! the point of these next two pages is to have text pages that |
| 179 | ! can be written and read |
| 180 | !-------------------------------------------------------------- |
| 181 | ALIGN_PAGE_8K |
| 182 | user_text2_start: |
| 183 | |
| 184 | main1: |
| 185 | mov 1,%l0 ! Replaced with copied_code second pass |
| 186 | jmpl %o7+8, %g0 |
| 187 | nop |
| 188 | main2: |
| 189 | mov 2,%l0 |
| 190 | nop |
| 191 | nop |
| 192 | nop |
| 193 | nop |
| 194 | nop |
| 195 | nop |
| 196 | nop |
| 197 | nop |
| 198 | nop |
| 199 | main3: |
| 200 | mov 3,%l0 |
| 201 | nop |
| 202 | nop |
| 203 | nop |
| 204 | nop |
| 205 | nop |
| 206 | nop |
| 207 | nop |
| 208 | nop |
| 209 | nop |
| 210 | nop |
| 211 | nop |
| 212 | nop |
| 213 | nop |
| 214 | nop |
| 215 | nop |
| 216 | nop |
| 217 | nop |
| 218 | nop |
| 219 | nop |
| 220 | |
| 221 | main4: |
| 222 | mov 4,%l0 |
| 223 | nop |
| 224 | nop |
| 225 | nop |
| 226 | nop |
| 227 | nop |
| 228 | nop |
| 229 | nop |
| 230 | nop |
| 231 | main5: |
| 232 | mov 5,%l0 |
| 233 | nop |
| 234 | nop |
| 235 | nop |
| 236 | nop |
| 237 | nop |
| 238 | |
| 239 | main6: |
| 240 | mov 1,%l0 |
| 241 | nop |
| 242 | nop |
| 243 | nop |
| 244 | nop |
| 245 | nop |
| 246 | user_text2_end: |
| 247 | |
| 248 | /*********************************************************************** |
| 249 | Test case data start |
| 250 | ***********************************************************************/ |
| 251 | .data |
| 252 | |
| 253 | user_data_start: |
| 254 | .word 0x0 |
| 255 | user_data_end: |