Subversion Repositories HelenOS

Rev

Rev 1906 | Rev 1975 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1906 Rev 1917
Line 27... Line 27...
27
#
27
#
28
 
28
 
29
#include <arch/arch.h>
29
#include <arch/arch.h>
30
#include <arch/regdef.h>
30
#include <arch/regdef.h>
31
#include <arch/boot/boot.h>
31
#include <arch/boot/boot.h>
-
 
32
#include <arch/stack.h>
32
 
33
 
33
#include <arch/mm/mmu.h>
34
#include <arch/mm/mmu.h>
34
#include <arch/mm/tlb.h>
35
#include <arch/mm/tlb.h>
35
#include <arch/mm/tte.h>
36
#include <arch/mm/tte.h>
36
 
37
 
Line 54... Line 55...
54
 *
55
 *
55
 * Moreover, we depend on boot having established the
56
 * Moreover, we depend on boot having established the
56
 * following environment:
57
 * following environment:
57
 * - TLBs are on
58
 * - TLBs are on
58
 * - identity mapping for the kernel image
59
 * - identity mapping for the kernel image
59
 * - identity mapping for memory stack
-
 
60
 */
60
 */
61
 
61
 
62
.global kernel_image_start
62
.global kernel_image_start
63
kernel_image_start:
63
kernel_image_start:
64
	mov %o0, %l7
64
	mov %o0, %l7
65
 
65
 
66
	/*
66
	/*
67
	 * Setup basic runtime environment.
67
	 * Setup basic runtime environment.
68
	 */
68
	 */
69
 
69
 
70
	flushw					! flush all but the active register window
70
	wrpr %g0, NWINDOWS - 2, %cansave		! set maximum saveable windows
-
 
71
	wrpr %g0, 0, %canrestore		! get rid of windows we will never need again
-
 
72
	wrpr %g0, 0, %otherwin			! make sure the window state is consistent
-
 
73
	wrpr %g0, NWINDOWS - 1, %cleanwin	! prevent needless clean_window traps for kernel
71
 
74
 
72
	wrpr %g0, 0, %tl			! TL = 0, primary context register is used
75
	wrpr %g0, 0, %tl			! TL = 0, primary context register is used
73
 
76
 
74
	wrpr %g0, PSTATE_PRIV_BIT, %pstate	! Disable interrupts and disable 32-bit address masking.
77
	wrpr %g0, PSTATE_PRIV_BIT, %pstate	! Disable interrupts and disable 32-bit address masking.
75
 
78
 
Line 213... Line 216...
213
	wrpr %g0, 0, %tl
216
	wrpr %g0, 0, %tl
214
 
217
 
215
	brz %l7, 1f				! skip if you are not the bootstrap CPU
218
	brz %l7, 1f				! skip if you are not the bootstrap CPU
216
	nop
219
	nop
217
 
220
 
-
 
221
	/*
-
 
222
	 * So far, we have not touched the stack.
-
 
223
	 * It is a good idead to set the kernel stack to a known state now.
-
 
224
	 */
-
 
225
	sethi %hi(temporary_boot_stack), %sp
-
 
226
	or %sp, %lo(temporary_boot_stack), %sp
-
 
227
	sub %sp, STACK_BIAS, %sp
-
 
228
 
218
	sethi %hi(bootinfo), %o0
229
	sethi %hi(bootinfo), %o0
219
	call memcpy				! copy bootinfo
230
	call memcpy				! copy bootinfo
220
	or %o0, %lo(bootinfo), %o0
231
	or %o0, %lo(bootinfo), %o0
221
 
232
 
222
	call arch_pre_main
233
	call arch_pre_main
Line 270... Line 281...
270
#endif
281
#endif
271
	
282
	
272
0:
283
0:
273
	ba 0b
284
	ba 0b
274
	nop
285
	nop
-
 
286
 
-
 
287
 
-
 
288
.section K_DATA_START, "aw", @progbits
-
 
289
 
-
 
290
/*
-
 
291
 * Create small stack to be used by the bootstrap processor.
-
 
292
 * It is going to be used only for a very limited period of
-
 
293
 * time, but we switch to it anyway, just to be sure we are
-
 
294
 * properly initialized.
-
 
295
 *
-
 
296
 * What is important is that this piece of memory is covered
-
 
297
 * by the 4M DTLB locked entry and therefore there will be
-
 
298
 * no surprises like deadly combinations of spill trap and
-
 
299
 * and TLB miss on the stack address.
-
 
300
 */
-
 
301
 
-
 
302
#define INITIAL_STACK_SIZE	1024
-
 
303
 
-
 
304
.align STACK_ALIGNMENT
-
 
305
.space INITIAL_STACK_SIZE
-
 
306
.align STACK_ALIGNMENT
-
 
307
temporary_boot_stack:
-
 
308
.space STACK_WINDOW_SAVE_AREA_SIZE