Subversion Repositories HelenOS

Rev

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

Rev 2787 Rev 3597
Line 37... Line 37...
37
 
37
 
38
#define KERNEL_TRANSLATION_I  0x0010000000000661
38
#define KERNEL_TRANSLATION_I  0x0010000000000661
39
#define KERNEL_TRANSLATION_D  0x0010000000000661
39
#define KERNEL_TRANSLATION_D  0x0010000000000661
40
#define KERNEL_TRANSLATION_VIO 0x0010000000000671
40
#define KERNEL_TRANSLATION_VIO 0x0010000000000671
41
#define KERNEL_TRANSLATION_IO 0x00100FFFFC000671 
41
#define KERNEL_TRANSLATION_IO 0x00100FFFFC000671 
42
#define VIO_OFFSET            0x0002000000000000
-
 
43
 
-
 
44
#define IO_OFFSET             0x0001000000000000
42
#define KERNEL_TRANSLATION_FW 0x00100000F0000671 
45
 
43
 
46
 
44
 
47
 
45
 
48
.section K_TEXT_START, "ax"
46
.section K_TEXT_START, "ax"
49
 
47
 
Line 51... Line 49...
51
 
49
 
52
stack0:
50
stack0:
53
kernel_image_start:
51
kernel_image_start:
54
	.auto
52
	.auto
55
 
53
 
-
 
54
#identifi self(CPU) in OS structures by ID / EID
-
 
55
	mov r9=cr64
-
 
56
	mov r10=1
-
 
57
	movl r12=0xffffffff
-
 
58
	movl r8=cpu_by_id_eid_list
-
 
59
	and r8=r8,r12
-
 
60
	shr r9=r9,16
-
 
61
	add r8=r8,r9
-
 
62
	st1 [r8]=r10
-
 
63
 
-
 
64
 
-
 
65
 
56
	mov psr.l = r0
66
	mov psr.l = r0
57
	srlz.i
67
	srlz.i
58
	srlz.d
68
	srlz.d
59
 
69
 
60
	# Fill TR.i and TR.d using Region Register #VRN_KERNEL
70
	# Fill TR.i and TR.d using Region Register #VRN_KERNEL
Line 112... Line 122...
112
	mov cr.ifa = r8
122
	mov cr.ifa = r8
113
	movl r10 = (KERNEL_TRANSLATION_IO)
123
	movl r10 = (KERNEL_TRANSLATION_IO)
114
	itr.d dtr[r7] = r10
124
	itr.d dtr[r7] = r10
115
 
125
 
116
 
126
 
-
 
127
#setup mapping for fimware arrea (also SAPIC)
-
 
128
	mov r11 = cr.itir ;;
-
 
129
	movl r10 = ~0xfc;;
-
 
130
	and r10 =r10 , r11  ;;
-
 
131
	movl r11 = (FW_PAGE_WIDTH << PS_SHIFT);;
-
 
132
	or r10 =r10 , r11  ;;
-
 
133
	mov cr.itir = r10;;
-
 
134
 
-
 
135
 
-
 
136
	movl r7 = 3
-
 
137
	movl r8 = (VRN_KERNEL << VRN_SHIFT) | FW_OFFSET
-
 
138
	mov cr.ifa = r8
-
 
139
	movl r10 = (KERNEL_TRANSLATION_FW)
-
 
140
	itr.d dtr[r7] = r10
-
 
141
 
-
 
142
 
-
 
143
 
117
 
144
 
118
 
145
 
119
	# initialize PSR
146
	# initialize PSR
120
	movl r10 = (PSR_DT_MASK | PSR_RT_MASK | PSR_IT_MASK | PSR_IC_MASK)  /* Enable paging */
147
	movl r10 = (PSR_DT_MASK | PSR_RT_MASK | PSR_IT_MASK | PSR_IC_MASK)  /* Enable paging */
121
	mov r9 = psr
148
	mov r9 = psr
Line 140... Line 167...
140
	 * Now we are paging.
167
	 * Now we are paging.
141
	 */
168
	 */
142
 
169
 
143
	# switch to register bank 1
170
	# switch to register bank 1
144
	bsw.1
171
	bsw.1
-
 
172
 
-
 
173
#Am'I BSP or AP
-
 
174
	movl r20=bsp_started;;
-
 
175
	ld8 r20=[r20];;
-
 
176
	cmp.eq p3,p2=r20,r0;;
-
 
177
 
145
	
178
	
146
	# initialize register stack
179
	# initialize register stack
147
	mov ar.rsc = r0
180
	mov ar.rsc = r0
148
	movl r8 = (VRN_KERNEL << VRN_SHIFT) ;;
181
	movl r8 = (VRN_KERNEL << VRN_SHIFT) ;;
149
	mov ar.bspstore = r8
182
	mov ar.bspstore = r8
Line 158... Line 191...
158
	movl r20 = (VRN_KERNEL << VRN_SHIFT);;
191
	movl r20 = (VRN_KERNEL << VRN_SHIFT);;
159
	or r20 = r20,r1;;
192
	or r20 = r20,r1;;
160
	movl r1 = _hardcoded_load_address
193
	movl r1 = _hardcoded_load_address
161
	
194
	
162
	/*
195
	/*
163
	 * Initialize hardcoded_* variables.
196
	 * Initialize hardcoded_* variables. Do only BSP
164
	 */
197
	 */
165
	movl r14 = _hardcoded_ktext_size
198
(p3)	movl r14 = _hardcoded_ktext_size
166
	movl r15 = _hardcoded_kdata_size
199
(p3)	movl r15 = _hardcoded_kdata_size
167
	movl r16 = _hardcoded_load_address ;;
200
(p3)	movl r16 = _hardcoded_load_address ;;
168
	addl r17 = @gprel(hardcoded_ktext_size), gp
201
(p3)	addl r17 = @gprel(hardcoded_ktext_size), gp
169
	addl r18 = @gprel(hardcoded_kdata_size), gp
202
(p3)	addl r18 = @gprel(hardcoded_kdata_size), gp
170
	addl r19 = @gprel(hardcoded_load_address), gp
203
(p3)	addl r19 = @gprel(hardcoded_load_address), gp
171
	addl r21 = @gprel(bootinfo), gp
204
(p3)	addl r21 = @gprel(bootinfo), gp
172
	;;
205
	;;
173
	st8 [r17] = r14
206
(p3)	st8 [r17] = r14
174
	st8 [r18] = r15
207
(p3)	st8 [r18] = r15
175
	st8 [r19] = r16
208
(p3)	st8 [r19] = r16
176
	st8 [r21] = r20
209
(p3)	st8 [r21] = r20
177
 
210
 
178
	ssm (1 << 19) ;; /* Disable f32 - f127 */
211
	ssm (1 << 19) ;; /* Disable f32 - f127 */
179
	srlz.i
212
	srlz.i
180
	srlz.d ;;
213
	srlz.d ;;
181
 
214
 
-
 
215
(p2)	movl r18 = main_ap ;;
-
 
216
(p2)   	mov b1 = r18 ;;
-
 
217
(p2)	br.call.sptk.many b0 = b1
-
 
218
 
-
 
219
#Mark that BSP is on
-
 
220
	mov r20=1;;
-
 
221
	movl r21=bsp_started;;
-
 
222
	st8 [r21]=r20;;
-
 
223
 
-
 
224
 
182
	br.call.sptk.many b0 = arch_pre_main
225
	br.call.sptk.many b0 = arch_pre_main
183
 
226
 
184
	movl r18 = main_bsp ;;
227
	movl r18 = main_bsp ;;
185
	mov b1 = r18 ;;
228
	mov b1 = r18 ;;
186
	br.call.sptk.many b0 = b1
229
	br.call.sptk.many b0 = b1
187
 
230
 
188
 
231
 
189
0:
232
0:
190
	br 0b
233
	br 0b
-
 
234
.align 4096
-
 
235
 
-
 
236
kernel_image_ap_start:
-
 
237
	.auto
-
 
238
#identifi self(CPU) in OS structures by ID / EID
-
 
239
	mov r9=cr64
-
 
240
	mov r10=1
-
 
241
	movl r12=0xffffffff
-
 
242
	movl r8=cpu_by_id_eid_list
-
 
243
	and r8=r8,r12
-
 
244
	shr r9=r9,16
-
 
245
	add r8=r8,r9
-
 
246
	st1 [r8]=r10
-
 
247
	
-
 
248
#wait for wakeup sychro signal (#3 in cpu_by_id_eid_list)
-
 
249
kernel_image_ap_start_loop:
-
 
250
	movl r11=kernel_image_ap_start_loop
-
 
251
	and r11=r11,r12
-
 
252
   	mov b1 = r11 
-
 
253
 
-
 
254
	ld1 r20=[r8];;
-
 
255
	movl r21=3;;
-
 
256
	cmp.eq p2,p3=r20,r21;;
-
 
257
(p3)br.call.sptk.many b0 = b1
-
 
258
 
-
 
259
	movl r11=kernel_image_start
-
 
260
	and r11=r11,r12
-
 
261
    mov b1 = r11 
-
 
262
	br.call.sptk.many b0 = b1
-
 
263
 
-
 
264
 
-
 
265
.align 16
-
 
266
.global bsp_started
-
 
267
bsp_started:
-
 
268
.space 8
-
 
269
 
-
 
270
 
-
 
271
.align 4096
-
 
272
.global cpu_by_id_eid_list
-
 
273
cpu_by_id_eid_list:
-
 
274
.space 65536
-
 
275
 
-
 
276