Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: isa3_trap_0x3f.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 MY_USER_TEXT_VA 0xa0000 | |
39 | #define MY_USER_TEXT_RA 0x00000000400a0000 | |
40 | #define MY_USER_TEXT_PA 0x00000010400a0000 | |
41 | #define MY_USER_DATA_VA 0xb0000 | |
42 | #define MY_USER_DATA_RA 0x00000000400b0000 | |
43 | #define MY_USER_DATA_PA 0x00000010400b0000 | |
44 | #define MY_PRIV_TEXT_VA 0xc0000 | |
45 | #define MY_PRIV_TEXT_RA 0x00000000400d0000 | |
46 | #define MY_PRIV_TEXT_PA 0x00000010400d0000 | |
47 | #define MY_PRIV_DATA_VA 0xe0000 | |
48 | #define MY_PRIV_DATA_RA 0x00000000400f0000 | |
49 | #define MY_PRIV_DATA_PA 0x00000010400f0000 | |
50 | #define MY_HP_TEXT_PA 0x0000001050000000 | |
51 | ||
52 | !!! Custom trap handler | |
53 | #define H_HT0_Data_Real_Tran_Miss_0x3f | |
54 | #define My_HT0_Data_Real_Tran_Miss_0x3f \ | |
55 | setx My_HP_Code_Begin, %l1, %l3 ; \ | |
56 | jmp %l3 ; \ | |
57 | nop ; | |
58 | ||
59 | #define MAIN_PAGE_HV_ALSO | |
60 | #define MAIN_PAGE_NUCLEUS_ALSO | |
61 | ||
62 | #include "hboot.s" | |
63 | ||
64 | /************************************************************************ | |
65 | Test case code start | |
66 | ************************************************************************/ | |
67 | ||
68 | .text | |
69 | .global main | |
70 | .global test_point | |
71 | ||
72 | main: /* test begin */ | |
73 | !!! We are assuming DM bit is set at this point! | |
74 | ta T_CHANGE_HPRIV | |
75 | ! Can't do the read and xor to flip the DM bit because of a bug in Simics | |
76 | ! Hard-code the value for lsu_ctl_reg with DM=0 | |
77 | !ldxa [%g0] ASI_LSU_CTL_REG, %l1 | |
78 | !xor %l1, 8, %l1 ! clearing DM bit | |
79 | setx 0x017, %l1, %l2 | |
80 | stxa %l2, [%g0] ASI_LSU_CTL_REG | |
81 | setx user_data_begin, %l1, %l2 | |
82 | ta T_CHANGE_NONHPRIV | |
83 | ta T_CHANGE_NONPRIV | |
84 | test_point: | |
85 | ldx [%l2], %l1 | |
86 | ||
87 | EXIT_BAD | |
88 | nop | |
89 | ||
90 | /************************************************************************ | |
91 | Test case data start | |
92 | ************************************************************************/ | |
93 | .data | |
94 | ||
95 | user_data_start: | |
96 | .word 0xD6B3479D | |
97 | .word 0xDB28926C | |
98 | ||
99 | SECTION .My_HP_Section TEXT_VA=MY_HP_TEXT_PA | |
100 | attr_text { | |
101 | Name = .My_HP_Section, | |
102 | hypervisor | |
103 | } | |
104 | .text | |
105 | .global My_HP_Code_Begin | |
106 | ||
107 | My_HP_Code_Begin: | |
108 | setx test_point, %l1, %l3 | |
109 | rdpr %tpc, %l2 | |
110 | cmp %l2, %l3 | |
111 | bne test_failed | |
112 | nop | |
113 | EXIT_GOOD | |
114 | test_failed: | |
115 | EXIT_BAD | |
116 | ||
117 | SECTION .My_User_Section TEXT_VA=MY_USER_TEXT_VA | |
118 | attr_text { | |
119 | Name = .My_User_Section, | |
120 | VA = MY_USER_TEXT_VA, | |
121 | RA = MY_USER_TEXT_RA, | |
122 | PA = MY_USER_TEXT_PA, | |
123 | part_0_ctx_nonzero_tsb_config_0, | |
124 | TTE_G=1, TTE_Context=0x44, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
125 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
126 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=0, TTE_W=1 | |
127 | } | |
128 | ||
129 | .text | |
130 | .global user_code_begin | |
131 | ||
132 | user_code_begin: | |
133 | nop | |
134 | nop | |
135 | EXIT_GOOD | |
136 | ||
137 | SECTION .My_User_Data_Section DATA_VA=MY_USER_DATA_VA | |
138 | attr_data { | |
139 | Name = .My_User_Data_Section, | |
140 | VA = MY_USER_DATA_VA, | |
141 | RA = MY_USER_DATA_RA, | |
142 | PA = MY_USER_DATA_PA, | |
143 | part_0_ctx_nonzero_tsb_config_0, | |
144 | TTE_G=1, TTE_Context=0x44, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
145 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
146 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=0, TTE_W=1 | |
147 | } | |
148 | ||
149 | .text | |
150 | .global user_data_begin | |
151 | ||
152 | user_data_begin: | |
153 | .xword 0101010101010101 | |
154 | .xword 0202020202020202 | |
155 | .xword 0303030303030303 | |
156 | .xword 0404040404040404 | |
157 | ||
158 | SECTION .My_Priv_Section TEXT_VA=MY_PRIV_TEXT_VA | |
159 | attr_text { | |
160 | Name = .My_Priv_Section, | |
161 | VA = MY_PRIV_TEXT_VA, | |
162 | RA = MY_PRIV_TEXT_RA, | |
163 | PA = MY_PRIV_TEXT_PA, | |
164 | part_0_ctx_nonzero_tsb_config_0, | |
165 | TTE_G=1, TTE_Context=0x44, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
166 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
167 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=1, TTE_W=1 | |
168 | } | |
169 | ||
170 | .text | |
171 | .global supervisor_code_begin | |
172 | ||
173 | supervisor_code_begin: | |
174 | nop ! should take a trap here | |
175 | nop | |
176 | EXIT_BAD | |
177 | ||
178 | SECTION .My_Priv_Data_Section DATA_VA=MY_PRIV_DATA_VA | |
179 | attr_data { | |
180 | Name = .My_Priv_Data_Section, | |
181 | VA = MY_PRIV_DATA_VA, | |
182 | RA = MY_PRIV_DATA_RA, | |
183 | PA = MY_PRIV_DATA_PA, | |
184 | part_0_ctx_nonzero_tsb_config_0, | |
185 | TTE_G=1, TTE_Context=0x44, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
186 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
187 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=1, TTE_W=1 | |
188 | } | |
189 | ||
190 | .data | |
191 | .global supervisor_data_begin | |
192 | ||
193 | supervisor_data_begin: | |
194 | .xword 1212121212121212 | |
195 | .xword 1313131313131313 | |
196 | .xword 1414141414141414 | |
197 | .xword 1515151515151515 | |
198 | ||
199 | .end |