Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: template_st.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 USER_START_LABEL c_start | |
39 | #define MAIN_TEXT_DATA_ALSO | |
40 | /* | |
41 | Include this before boot.s to use spill/fill traps | |
42 | */ | |
43 | ||
44 | #include "c/ctraps.h" | |
45 | #include "hboot.s" | |
46 | ||
47 | ||
48 | #ifndef CUSTOM_TRAPS_BASE_TEXT_ADDR | |
49 | #define CUSTOM_TRAPS_BASE_TEXT_ADDR 0x500000 | |
50 | #endif | |
51 | ||
52 | #ifndef CUSTOM_TRAPS_BASE_TEXT_ADDR_RA | |
53 | #define CUSTOM_TRAPS_BASE_TEXT_ADDR_RA 0x10500000 | |
54 | #endif | |
55 | ||
56 | #ifndef CUSTOM_TRAPS_BASE_DATA_ADDR | |
57 | #define CUSTOM_TRAPS_BASE_DATA_ADDR 0x540000 | |
58 | #endif | |
59 | ||
60 | #ifndef CUSTOM_TRAPS_BASE_DATA_ADDR_RA | |
61 | #define CUSTOM_TRAPS_BASE_DATA_ADDR_RA 0x10540000 | |
62 | #endif | |
63 | ||
64 | #ifndef COMMON_BASE_TEXT_ADDR | |
65 | #define COMMON_BASE_TEXT_ADDR 0x510000 | |
66 | #endif | |
67 | ||
68 | #ifndef COMMON_BASE_TEXT_ADDR_RA | |
69 | #define COMMON_BASE_TEXT_ADDR_RA 0x10510000 | |
70 | #endif | |
71 | ||
72 | #ifndef COMMON_BASE_DATA_ADDR | |
73 | #define COMMON_BASE_DATA_ADDR 0x550000 | |
74 | #endif | |
75 | ||
76 | #ifndef COMMON_BASE_DATA_ADDR_RA | |
77 | #define COMMON_BASE_DATA_ADDR_RA 0x10550000 | |
78 | #endif | |
79 | ||
80 | ||
81 | #ifndef LIBC_BASE_TEXT_ADDR | |
82 | #define LIBC_BASE_TEXT_ADDR 0x570000 | |
83 | #endif | |
84 | ||
85 | #ifndef LIBC_BASE_TEXT_ADDR_RA | |
86 | #define LIBC_BASE_TEXT_ADDR_RA 0x10570000 | |
87 | #endif | |
88 | ||
89 | #ifndef LIBC_BASE_DATA_ADDR | |
90 | #define LIBC_BASE_DATA_ADDR 0x560000 | |
91 | #endif | |
92 | ||
93 | #ifndef LIBC_BASE_DATA_ADDR_RA | |
94 | #define LIBC_BASE_DATA_ADDR_RA 0x10560000 | |
95 | #endif | |
96 | ||
97 | #ifndef MAIN_RODATA_ADDR | |
98 | # define MAIN_RODATA_ADDR 0x20020000 | |
99 | #endif | |
100 | ||
101 | #ifndef MAIN_RODATA_ADDR_RA | |
102 | # define MAIN_RODATA_ADDR_RA 0x130020000 | |
103 | #endif | |
104 | ||
105 | #ifndef MAIN_RODATA_ADDR_PA | |
106 | # define MAIN_RODATA_ADDR_PA 0x1130020000 | |
107 | #endif | |
108 | ||
109 | ||
110 | /***************************************************************************** | |
111 | * | |
112 | * | |
113 | * SECTION .CUSTOM_TRAPS | |
114 | * | |
115 | * Trap handlers that will run in nucleus context | |
116 | * | |
117 | * | |
118 | *****************************************************************************/ | |
119 | ||
120 | SECTION .CUSTOM_TRAPS \ | |
121 | TEXT_VA=CUSTOM_TRAPS_BASE_TEXT_ADDR, \ | |
122 | DATA_VA=CUSTOM_TRAPS_BASE_DATA_ADDR | |
123 | ||
124 | attr_text { | |
125 | NAME=.CUSTOM_TRAPS, | |
126 | VA=CUSTOM_TRAPS_BASE_TEXT_ADDR, | |
127 | #ifdef NIAGARA | |
128 | RA=CUSTOM_TRAPS_BASE_TEXT_ADDR_RA, | |
129 | PA=ra2pa(CUSTOM_TRAPS_BASE_TEXT_ADDR_RA, 0), | |
130 | #ifndef USE_N1_TSB_NAMES | |
131 | part_0_ctx_nzero_tsb_config_1, | |
132 | #else | |
133 | part_0_d_ctx_nzero_ps0_tsb, | |
134 | #endif | |
135 | #else | |
136 | Code, | |
137 | PA=CUSTOM_TRAPS_BASE_TEXT_ADDR_RA, | |
138 | #endif | |
139 | TTE_G=1, TTE_Context=0, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
140 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
141 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=0, TTE_W=0 | |
142 | } | |
143 | ||
144 | attr_data { | |
145 | NAME=.CUSTOM_TRAPS, | |
146 | VA=CUSTOM_TRAPS_BASE_DATA_ADDR, | |
147 | #ifdef NIAGARA | |
148 | RA=CUSTOM_TRAPS_BASE_DATA_ADDR_RA, | |
149 | PA=ra2pa(CUSTOM_TRAPS_BASE_DATA_ADDR_RA, 0), | |
150 | #ifndef USE_N1_TSB_NAMES | |
151 | part_0_ctx_zero_tsb_config_1, | |
152 | #else | |
153 | part_0_d_ctx_zero_ps0_tsb, | |
154 | #endif | |
155 | #else | |
156 | Data, | |
157 | PA=CUSTOM_TRAPS_BASE_DATA_ADDR_RA, | |
158 | #endif | |
159 | TTE_G=1, TTE_Context=0, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
160 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
161 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=0, TTE_W=1 | |
162 | } | |
163 | ||
164 | #include "c/ctraps.s" | |
165 | ||
166 | /***************************************************************************** | |
167 | * | |
168 | * SECTION .BSS | |
169 | * | |
170 | * Set up uninitialized data segment | |
171 | * | |
172 | *****************************************************************************/ | |
173 | ||
174 | ||
175 | SECTION .STACK0 \ | |
176 | BSS_VA=COMMON_BASE_DATA_ADDR | |
177 | ||
178 | attr_bss { | |
179 | NAME=.STACK0 | |
180 | VA=COMMON_BASE_DATA_ADDR, | |
181 | #ifdef NIAGARA | |
182 | RA=COMMON_BASE_DATA_ADDR_RA, | |
183 | PA=ra2pa(COMMON_BASE_DATA_ADDR_RA, 0), | |
184 | #ifndef USE_N1_TSB_NAMES | |
185 | part_0_ctx_nonzero_tsb_config_1, | |
186 | #else | |
187 | part_0_d_ctx_nonzero_ps0_tsb, | |
188 | #endif | |
189 | #else | |
190 | PA=COMMON_BASE_DATA_ADDR_RA, | |
191 | Data, | |
192 | #endif | |
193 | TTE_G=1, TTE_Context=PCONTEXT, | |
194 | TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
195 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
196 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=0, TTE_W=1 | |
197 | } | |
198 | ||
199 | .section .bss | |
200 | ||
201 | .global stack0 | |
202 | stack0: | |
203 | .skip STACKSIZE | |
204 | ||
205 | /***************************************************************************** | |
206 | * | |
207 | * SECTION .LIBC | |
208 | * | |
209 | * Code and data for C library | |
210 | * | |
211 | *****************************************************************************/ | |
212 | ||
213 | ||
214 | ||
215 | SECTION .LIBC \ | |
216 | TEXT_VA=LIBC_BASE_TEXT_ADDR, \ | |
217 | DATA_VA=LIBC_BASE_DATA_ADDR | |
218 | ||
219 | attr_text { | |
220 | NAME=.LIBC | |
221 | VA=LIBC_BASE_TEXT_ADDR, | |
222 | #ifdef NIAGARA | |
223 | RA=LIBC_BASE_TEXT_ADDR_RA, | |
224 | PA=ra2pa(LIBC_BASE_TEXT_ADDR_RA, 0), | |
225 | #ifndef USE_N1_TSB_NAMES | |
226 | part_0_ctx_nonzero_tsb_config_0, | |
227 | #else | |
228 | part_0_i_ctx_nonzero_ps0_tsb, | |
229 | #endif | |
230 | #else | |
231 | PA=LIBC_BASE_TEXT_ADDR_RA, | |
232 | Code, | |
233 | #endif | |
234 | TTE_G=0, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, | |
235 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
236 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=0, TTE_W=0 | |
237 | } | |
238 | ||
239 | attr_data { | |
240 | NAME=.LIBC, | |
241 | VA=LIBC_BASE_DATA_ADDR, | |
242 | #ifdef NIAGARA | |
243 | RA=LIBC_BASE_DATA_ADDR_RA, | |
244 | PA=ra2pa(LIBC_BASE_DATA_ADDR_RA, 0), | |
245 | #ifndef USE_N1_TSB_NAMES | |
246 | part_0_ctx_nonzero_tsb_config_1, | |
247 | #else | |
248 | part_0_d_ctx_nonzero_ps0_tsb, | |
249 | #endif | |
250 | #else | |
251 | PA=LIBC_BASE_DATA_ADDR_RA, | |
252 | Data, | |
253 | #endif | |
254 | TTE_G=0, TTE_Context=PCONTEXT, TTE_V=1, | |
255 | TTE_Size=0, TTE_NFO=0, | |
256 | TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, | |
257 | TTE_L=0, TTE_CP=1, TTE_CV=0, TTE_E=0, TTE_P=0, TTE_W=1 | |
258 | } | |
259 | ||
260 | ||
261 | #include "c/stackinit_st.s" | |
262 | #include "c/libc.s" | |
263 | ||
264 | /***************************************************************************** | |
265 | * | |
266 | * SECTION .MAIN | |
267 | * | |
268 | * Put user code back in MAIN | |
269 | * | |
270 | *****************************************************************************/ | |
271 | ||
272 | ||
273 | SECTION .MAIN |