Subversion Repositories HelenOS

Rev

Rev 4369 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4369 Rev 4614
Line 27... Line 27...
27
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
#
28
#
29
 
29
 
30
#include <arch/arch.h>
30
#include <arch/arch.h>
31
#include <arch/stack.h>
31
#include <arch/stack.h>
-
 
32
#include <arch/context_offset.h>
32
#include <arch/sun4v/regdef.h>
33
#include <arch/sun4v/regdef.h>
33
#include <arch/sun4v/hypercall.h>
34
#include <arch/sun4v/hypercall.h>
34
#include <arch/sun4v/arch.h>
35
#include <arch/sun4v/arch.h>
35
#include <arch/sun4v/cpu.h>
36
#include <arch/sun4v/cpu.h>
36
#include <arch/mm/pagesize.h>
37
#include <arch/mm/pagesize.h>
Line 140... Line 141...
140
	 * Switch to kernel trap table.
141
	 * Switch to kernel trap table.
141
	 */
142
	 */
142
	sethi %hi(trap_table), %g1
143
	sethi %hi(trap_table), %g1
143
	wrpr %g1, %lo(trap_table), %tba
144
	wrpr %g1, %lo(trap_table), %tba
144
 
145
 
-
 
146
	/* Explicitly switch to hypervisor API 1.1. */
-
 
147
	mov 1, %o0
-
 
148
   	mov 1, %o1
-
 
149
   	mov 1, %o2
-
 
150
   	mov 0, %o3
-
 
151
   	mov 0, %o4
-
 
152
   	mov 0, %o5
-
 
153
   	ta 0xff
-
 
154
   	nop
145
 
155
 
146
	/*
156
	/*
147
	 * Take over the MMU.
157
	 * Take over the MMU.
148
	 */
158
	 */
149
 
159
 
Line 182... Line 192...
182
	set 0, %o0						! reserved
192
	set 0, %o0						! reserved
183
	set 0, %o1						! reserved
193
	set 0, %o1						! reserved
184
	set 1, %o2						! context
194
	set 1, %o2						! context
185
	set MMU_FLAG_DTLB | MMU_FLAG_ITLB, %o3			! MMU flags
195
	set MMU_FLAG_DTLB | MMU_FLAG_ITLB, %o3			! MMU flags
186
	__HYPERCALL_FAST(MMU_DEMAP_CTX)
196
	__HYPERCALL_FAST(MMU_DEMAP_CTX)
187
	
-
 
188
	/*
-
 
189
	 * Save physmem_base for use by the mm subsystem.
-
 
190
	 * %l6 contains starting physical address
-
 
191
	 */
-
 
192
	sethi %hi(physmem_base), %l4
-
 
193
	stx %l6, [%l4 + %lo(physmem_base)]
-
 
194
 
197
 
195
	/*
198
	/*
196
	 * Set CPUID.
199
	 * Set CPUID.
197
	 */
200
	 */
198
	__HYPERCALL_FAST(CPU_MYID)
201
	__HYPERCALL_FAST(CPU_MYID)
Line 207... Line 210...
207
	mulx %o1, MMU_FSA_SIZE, %g1		! g1 <= offset of current CPU's fault status area
210
	mulx %o1, MMU_FSA_SIZE, %g1		! g1 <= offset of current CPU's fault status area
208
	add %g1, %o0, %o0			! o0 <= FSA of the current CPU
211
	add %g1, %o0, %o0			! o0 <= FSA of the current CPU
209
	mov SCRATCHPAD_MMU_FSA, %g1
212
	mov SCRATCHPAD_MMU_FSA, %g1
210
	stxa %o0, [%g1] ASI_SCRATCHPAD		! remember MMU fault status area to speed up miss handler
213
	stxa %o0, [%g1] ASI_SCRATCHPAD		! remember MMU fault status area to speed up miss handler
211
	__HYPERCALL_FAST(MMU_FAULT_AREA_CONF)
214
	__HYPERCALL_FAST(MMU_FAULT_AREA_CONF)
212
	
215
 
-
 
216
	! on APs skip executing the following code
-
 
217
	cmp %l7, 0
-
 
218
	be 1f
-
 
219
	nop
-
 
220
 
-
 
221
	/*
-
 
222
	 * Save physmem_base for use by the mm subsystem.
-
 
223
	 * %l6 contains starting physical address
-
 
224
	 */	
-
 
225
	sethi %hi(physmem_base), %l4
-
 
226
	stx %l6, [%l4 + %lo(physmem_base)]
-
 
227
 
213
	/*
228
	/*
214
	 * Store a template of a TTE Data entry for kernel mappings.
229
	 * Store a template of a TTE Data entry for kernel mappings.
215
	 * This template will be used from the kernel MMU miss handler.
230
	 * This template will be used from the kernel MMU miss handler.
216
	 */
231
	 */
217
	!TTE_DATA(0, %l5, %g2, %g3, %g1)
232
	!TTE_DATA(0, %l5, %g2, %g3, %g1)
Line 244... Line 259...
244
 
259
 
245
0:
260
0:
246
	ba 0b
261
	ba 0b
247
	nop
262
	nop
248
 
263
 
-
 
264
1:
-
 
265
 
-
 
266
#ifdef CONFIG_SMP
-
 
267
 
-
 
268
	/*
-
 
269
	 * Configure stack for the AP.
-
 
270
	 * The AP is expected to use the stack saved
-
 
271
	 * in the ctx global variable.
-
 
272
	 */
-
 
273
 
-
 
274
	mov	1, %o0			! MMU enable flag
-
 
275
	set	mmu_enabled, %o1
-
 
276
	mov	MMU_ENABLE, %o5	! MMU enable HV call
-
 
277
	ta	0x80		! call HV
-
 
278
 
-
 
279
	mmu_enabled:
-
 
280
 
-
 
281
	/*
-
 
282
	 * Configure stack for the AP.
-
 
283
	 * The AP is expected to use the stack saved
-
 
284
	 * in the ctx global variable.
-
 
285
	 */
-
 
286
	set ctx, %g1
-
 
287
	add %g1, OFFSET_SP, %g1
-
 
288
	ldx [%g1], %o6
-
 
289
 
-
 
290
	call main_ap
-
 
291
	nop
-
 
292
#endif
-
 
293
 
-
 
294
	/* Not reached. */
-
 
295
0:
-
 
296
	ba 0b
-
 
297
	nop
-
 
298
 
249
.section K_DATA_START, "aw", @progbits
299
.section K_DATA_START, "aw", @progbits
250
 
300
 
251
#define INITIAL_STACK_SIZE		1024
301
#define INITIAL_STACK_SIZE		1024
252
 
302
 
253
.align STACK_ALIGNMENT
303
.align STACK_ALIGNMENT