Subversion Repositories HelenOS

Rev

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

Rev 3343 Rev 3365
Line 45... Line 45...
45
.section K_TEXT_START, "ax"
45
.section K_TEXT_START, "ax"
46
 
46
 
47
#define BSP_FLAG	1
47
#define BSP_FLAG	1
48
 
48
 
49
/*
49
/*
-
 
50
 * 2^PHYSMEM_ADDR_SIZE is the size of the physical address space on
-
 
51
 * a given processor.
-
 
52
 */
-
 
53
#if defined (US2)
-
 
54
    #define PHYSMEM_ADDR_SIZE	41
-
 
55
#elif defined (US3)
-
 
56
    #define PHYSMEM_ADDR_SIZE	43
-
 
57
#endif
-
 
58
 
-
 
59
/*
50
 * Here is where the kernel is passed control from the boot loader.
60
 * Here is where the kernel is passed control from the boot loader.
51
 * 
61
 * 
52
 * The registers are expected to be in this state:
62
 * The registers are expected to be in this state:
53
 * - %o0 starting address of physical memory + bootstrap processor flag
63
 * - %o0 starting address of physical memory + bootstrap processor flag
54
 * 	bits 63...1:	physical memory starting address / 2
64
 * 	bits 63...1:	physical memory starting address / 2
Line 65... Line 75...
65
kernel_image_start:
75
kernel_image_start:
66
	mov BSP_FLAG, %l0
76
	mov BSP_FLAG, %l0
67
	and %o0, %l0, %l7			! l7 <= bootstrap processor?
77
	and %o0, %l0, %l7			! l7 <= bootstrap processor?
68
	andn %o0, %l0, %l6			! l6 <= start of physical memory
78
	andn %o0, %l0, %l6			! l6 <= start of physical memory
69
 
79
 
70
	! Get bits 40:13 of physmem_base.
80
	! Get bits (PHYSMEM_ADDR_SIZE - 1):13 of physmem_base.
71
	srlx %l6, 13, %l5
81
	srlx %l6, 13, %l5
-
 
82
	
-
 
83
	! l5 <= physmem_base[(PHYSMEM_ADDR_SIZE - 1):13]
72
	sllx %l5, 13 + (63 - 40), %l5
84
	sllx %l5, 13 + (63 - (PHYSMEM_ADDR_SIZE - 1)), %l5
73
	srlx %l5, 63 - 40, %l5			! l5 <= physmem_base[40:13]
85
	srlx %l5, 63 - (PHYSMEM_ADDR_SIZE - 1), %l5	
74
	
86
	
75
	/*
87
	/*
76
	 * Setup basic runtime environment.
88
	 * Setup basic runtime environment.
77
	 */
89
	 */
78
 
90
 
Line 81... Line 93...
81
						! never need again
93
						! never need again
82
	wrpr %g0, 0, %otherwin			! make sure the window state is
94
	wrpr %g0, 0, %otherwin			! make sure the window state is
83
						! consistent
95
						! consistent
84
	wrpr %g0, NWINDOWS - 1, %cleanwin	! prevent needless clean_window
96
	wrpr %g0, NWINDOWS - 1, %cleanwin	! prevent needless clean_window
85
						! traps for kernel
97
						! traps for kernel
-
 
98
						
-
 
99
	wrpr %g0, 0, %wstate			! use the default spill/fill trap
86
 
100
 
87
	wrpr %g0, 0, %tl			! TL = 0, primary context
101
	wrpr %g0, 0, %tl			! TL = 0, primary context
88
						! register is used
102
						! register is used
89
 
103
 
90
	wrpr %g0, PSTATE_PRIV_BIT, %pstate	! disable interrupts and disable
104
	wrpr %g0, PSTATE_PRIV_BIT, %pstate	! disable interrupts and disable
Line 242... Line 256...
242
	sethi %hi(physmem_base), %l4
256
	sethi %hi(physmem_base), %l4
243
	stx %l6, [%l4 + %lo(physmem_base)]
257
	stx %l6, [%l4 + %lo(physmem_base)]
244
 
258
 
245
	/*
259
	/*
246
	 * Precompute kernel 8K TLB data template.
260
	 * Precompute kernel 8K TLB data template.
247
	 * %l5 contains starting physical address bits [40:13]
261
	 * %l5 contains starting physical address
-
 
262
	 * bits [(PHYSMEM_ADDR_SIZE - 1):13]
248
	 */
263
	 */
249
	sethi %hi(kernel_8k_tlb_data_template), %l4
264
	sethi %hi(kernel_8k_tlb_data_template), %l4
250
	ldx [%l4 + %lo(kernel_8k_tlb_data_template)], %l3
265
	ldx [%l4 + %lo(kernel_8k_tlb_data_template)], %l3
251
	or %l3, %l5, %l3
266
	or %l3, %l5, %l3
252
	stx %l3, [%l4 + %lo(kernel_8k_tlb_data_template)]
267
	stx %l3, [%l4 + %lo(kernel_8k_tlb_data_template)]