| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: icacheMissSl3.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 STORE_VA 0xfffffffff0010000 |
| 39 | |
| 40 | |
| 41 | SECTION .RED_SEC TEXT_VA = 0xfffffffff0000000, DATA_VA = STORE_VA |
| 42 | |
| 43 | attr_text { |
| 44 | Name=.RED_SEC, |
| 45 | hypervisor |
| 46 | } |
| 47 | |
| 48 | attr_data { |
| 49 | Name=.RED_SEC, |
| 50 | hypervisor |
| 51 | } |
| 52 | |
| 53 | .text |
| 54 | |
| 55 | nop;nop;nop;nop;nop;nop;nop;nop |
| 56 | |
| 57 | Power_On_Reset: |
| 58 | setx data_area, %g2, %g1 |
| 59 | wrpr %g0, %g0, %tl |
| 60 | |
| 61 | |
| 62 | ! Setup a context |
| 63 | add 0xF, %g0, %g5 |
| 64 | add 0x8, %g0, %g6 |
| 65 | stxa %g5, [%g6] 0x21 |
| 66 | |
| 67 | |
| 68 | !turn on ITLB |
| 69 | ldxa [%g0] 0x45, %l5 |
| 70 | or 0xC, %l5, %l5 |
| 71 | stxa %l5, [%g0] 0x45 |
| 72 | |
| 73 | |
| 74 | ! Setup counter |
| 75 | set 0x1808c042, %l0 ! count I-Cache Misses |
| 76 | |
| 77 | wr %l0, %g0, %pcr ! count I-Cache Misses |
| 78 | wr %g0, %g0, %pic ! zero out the counter |
| 79 | |
| 80 | |
| 81 | !Create the address |
| 82 | setx 0xfffffffff1004000, %o1, %o2 |
| 83 | |
| 84 | ! Setup a TLB Entry |
| 85 | setx 0xfffffffff100400F, %g5, %g6 ! Data for Tag Access |
| 86 | setx 0x800000FFF0100000, %g5, %g7 ! Data for Data-Access |
| 87 | |
| 88 | add 0x30, %g0, %o0 |
| 89 | stxa %g6, [%o0] 0x50 ! Write tag access |
| 90 | stxa %g7, [%g0] 0x55 |
| 91 | |
| 92 | ! Setup a TLB Entry |
| 93 | setx 0xfffffffff010600F, %g5, %g6 ! Data for Tag Access |
| 94 | setx 0x800000FFF0106000, %g5, %g7 ! Data for Data-Access |
| 95 | |
| 96 | add 0x30, %g0, %o0 |
| 97 | add 0x10, %g0, %o1 |
| 98 | |
| 99 | stxa %g6, [%o0] 0x50 ! Write tag access |
| 100 | stxa %g7, [%o1] 0x55 |
| 101 | |
| 102 | ! rdhpr %hpstate, %g1 |
| 103 | ! andn %g1, 0x4, %g2 |
| 104 | |
| 105 | jmp %o2 |
| 106 | wrhpr %g0, %g0, %hpstate |
| 107 | |
| 108 | bad_trap: |
| 109 | ba bad_trap |
| 110 | nop |
| 111 | nop |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | .data |
| 117 | data_area: |
| 118 | .xword 0x0 |
| 119 | .xword 0x0 |
| 120 | |
| 121 | |
| 122 | SECTION .NEWSECTION TEXT_VA = 0xfffffffff0104000 |
| 123 | attr_text { |
| 124 | RA = 0xfff0100000, |
| 125 | PA = 0xfff0100000, |
| 126 | Name=.NEWSECTION, |
| 127 | notsb |
| 128 | } |
| 129 | .text |
| 130 | setx 0xfffffffff0106000, %l0, %l1 |
| 131 | jmp %l1 |
| 132 | nop |
| 133 | |
| 134 | |
| 135 | SECTION .NEWSECTION1 TEXT_VA = 0xfffffffff0106000 |
| 136 | attr_text { |
| 137 | RA = 0xfff0106000, |
| 138 | PA = 0xfff0106000, |
| 139 | Name=.NEWSECTION1, |
| 140 | notsb |
| 141 | } |
| 142 | .text |
| 143 | setx 0x123456789ABCDEF, %l2, %l3 |
| 144 | setx 0xF0000000F, %g2, %g5 |
| 145 | rd %pic, %g2 ! load the current pic value into %g2 |
| 146 | xor %g2, %g5, %g5 ! Compare expected results with actual |
| 147 | brnz %g5, bad_trap |
| 148 | nop |
| 149 | |
| 150 | good_trap: |
| 151 | ba good_trap |
| 152 | nop |
| 153 | nop |
| 154 | |
| 155 | bad_trap: |
| 156 | ba bad_trap |
| 157 | nop |
| 158 | nop |
| 159 | |
| 160 | |
| 161 | |