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