Changeset ff133e2 in mainline
- Timestamp:
- 2006-06-07T02:20:03Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8778271
- Parents:
- b0f8c84
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/boot/boot.S
rb0f8c84 rff133e2 59 59 movw $KDATA, %cx 60 60 movw %cx, %es 61 movw %cx, %fs 61 62 movw %cx, %gs 62 movw %cx, %fs63 63 movw %cx, %ds # kernel data + stack 64 64 movw %cx, %ss … … 69 69 pushl %ebx # save parameters from GRUB 70 70 pushl %eax 71 71 72 72 #ifdef CONFIG_FB 73 mov $vesa_init,%esi; 74 mov $VESA_INIT_SEGMENT<<4,%edi; 75 mov $e_vesa_init-vesa_init,%ecx; 76 cld; 77 rep movsb; 78 79 mov $VESA_INIT_SEGMENT<<4,%edi; 80 call *%edi; 81 mov %esi,KA2PA(vesa_ph_addr); 82 mov %di,KA2PA(vesa_height); 83 shr $16,%edi; 84 mov %di,KA2PA(vesa_width); 85 mov %bx,KA2PA(vesa_scanline); 86 shr $16,%ebx; 87 mov %bx,KA2PA(vesa_bpp); 73 mov $vesa_init, %esi 74 mov $VESA_INIT_SEGMENT << 4, %edi 75 mov $e_vesa_init - vesa_init, %ecx 76 cld 77 rep movsb 78 79 mov $VESA_INIT_SEGMENT << 4, %edi 80 jmpl %edi 81 82 vesa_meeting_point: 83 84 mov %esi, KA2PA(vesa_ph_addr) 85 mov %di, KA2PA(vesa_height) 86 shr $16, %edi 87 mov %di, KA2PA(vesa_width) 88 mov %bx, KA2PA(vesa_scanline) 89 shr $16, %ebx 90 mov %bx, KA2PA(vesa_bpp) 88 91 #endif 89 92 … … 251 254 #ifdef CONFIG_FB 252 255 vesa_init: 253 jmp $selector(VESA_INIT_DES),$vesa_init_real-vesa_init; 256 jmp $selector(VESA_INIT_DES), $vesa_init_real - vesa_init 257 254 258 .code16 255 vesa_init_real: 256 257 mov %cr0,%eax; 258 and $~1,%eax; 259 mov %eax,%cr0; 260 261 262 jmp $VESA_INIT_SEGMENT,$vesa_init_real2-vesa_init; 263 264 vesa_init_real2: 265 266 267 mov %esp,%ebp; 268 mov %ss,%cx; 269 mov $VESA_INIT_SEGMENT,%bx; 270 mov %bx,%ss; 271 mov $0x0000fffc,%esp; 272 push %ds; 273 push %es; 274 push %fs; 275 push %gs; 276 push %ebp; 277 push %cx; 278 279 mov %bx,%ds; 280 mov %bx,%es; 281 mov %bx,%fs; 282 mov %bx,%gs; 283 284 285 mov $vesa_idt-vesa_init,%ebx; 286 lidtl (%ebx); 287 259 vesa_init_real: 260 261 mov %cr0, %eax 262 and $~1, %eax 263 mov %eax, %cr0 264 265 jmp $VESA_INIT_SEGMENT, $vesa_init_real2 - vesa_init 266 267 vesa_init_real2: 268 269 mov $VESA_INIT_SEGMENT, %bx 270 271 mov %bx, %es 272 mov %bx, %fs 273 mov %bx, %gs 274 mov %bx, %ds 275 mov %bx, %ss 276 277 movl %esp, %eax 278 movl $0x0000fffc, %esp 279 movl $0x0000fffc, %ebp 280 pushl %eax 281 288 282 #define VESA_INFO_SIZE 1024 289 283 290 #define VESA_MODE_LIST_PTR_OFFSET 14 284 #define VESA_MODE_LIST_PTR_OFFSET 14 291 285 #define VESA_MODE_WIDTH_OFFSET 18 292 286 #define VESA_MODE_HEIGHT_OFFSET 20 … … 295 289 #define VESA_MODE_PHADDR_OFFSET 40 296 290 297 #define VESA_END_OF_MODES 0xffff 298 299 #define VESA_OK 0x4f 300 301 #define VESA_GET_INFO 0x4f00 291 #define VESA_END_OF_MODES 0xffff 292 293 #define VESA_OK 0x4f 294 295 #define VESA_GET_INFO 0x4f00 302 296 #define VESA_GET_MODE_INFO 0x4f01 303 297 #define VESA_SET_MODE 0x4f02 … … 305 299 #define CONFIG_VESA_BPP_a 255 306 300 307 #if CONFIG_VESA_BPP ==24301 #if CONFIG_VESA_BPP == 24 308 302 #undef CONFIG_VESA_BPP_a 309 303 #define CONFIG_VESA_BPP_a 32 310 304 #endif 311 305 312 313 mov $VESA_GET_INFO,%ax; 314 mov $e_vesa_init-vesa_init,%di 315 push %di; 316 int $0x10; 317 pop %di; 318 cmp $VESA_OK,%al; 319 jnz 0f; 320 mov 2+VESA_MODE_LIST_PTR_OFFSET(%di),%si; 321 mov %si,%gs; 322 mov VESA_MODE_LIST_PTR_OFFSET(%di),%si; 323 324 add $VESA_INFO_SIZE,%di; 306 mov $VESA_GET_INFO, %ax 307 mov $e_vesa_init - vesa_init, %di 308 push %di 309 int $0x10 310 311 pop %di 312 cmp $VESA_OK, %al 313 jnz 0f 314 315 mov 2 + VESA_MODE_LIST_PTR_OFFSET(%di), %si 316 mov %si, %gs 317 mov VESA_MODE_LIST_PTR_OFFSET(%di), %si 318 319 add $VESA_INFO_SIZE, %di 325 320 326 321 1:# Try next mode 327 mov %gs:(%si),%cx; 328 cmp $VESA_END_OF_MODES,%cx; 329 jz 0f; 330 inc %si; 331 inc %si; 332 push %cx; 333 push %di; 334 push %si; 335 mov $VESA_GET_MODE_INFO,%ax; 336 int $0x10; 337 pop %si; 338 pop %di; 339 pop %cx; 340 cmp $VESA_OK,%al; 341 jnz 0f; 342 343 344 mov $CONFIG_VESA_WIDTH,%ax; 345 cmp VESA_MODE_WIDTH_OFFSET(%di),%ax; 346 jnz 1b; 347 mov $CONFIG_VESA_HEIGHT,%ax; 348 cmp VESA_MODE_HEIGHT_OFFSET(%di),%ax; 349 jnz 1b; 350 mov $CONFIG_VESA_BPP,%al; 351 cmp VESA_MODE_BPP_OFFSET(%di),%al; 352 jz 2f; 353 mov $CONFIG_VESA_BPP_a,%al; 354 cmp VESA_MODE_BPP_OFFSET(%di),%al; 355 jnz 1b; 356 322 mov %gs:(%si), %cx 323 cmp $VESA_END_OF_MODES, %cx 324 jz 0f 325 326 inc %si 327 inc %si 328 push %cx 329 push %di 330 push %si 331 mov $VESA_GET_MODE_INFO, %ax 332 int $0x10 333 334 pop %si 335 pop %di 336 pop %cx 337 cmp $VESA_OK, %al 338 jnz 0f 339 340 mov $CONFIG_VESA_WIDTH, %ax 341 cmp VESA_MODE_WIDTH_OFFSET(%di), %ax 342 jnz 1b 343 344 mov $CONFIG_VESA_HEIGHT,%ax 345 cmp VESA_MODE_HEIGHT_OFFSET(%di), %ax 346 jnz 1b 347 348 mov $CONFIG_VESA_BPP, %al 349 cmp VESA_MODE_BPP_OFFSET(%di), %al 350 jz 2f 351 352 mov $CONFIG_VESA_BPP_a, %al 353 cmp VESA_MODE_BPP_OFFSET(%di), %al 354 jnz 1b 355 357 356 2: 358 359 mov %cx,%bx; 360 or $0xC000,%bx; 361 push %di; 362 mov $VESA_SET_MODE,%ax; 363 int $0x10; 364 pop %di; 365 cmp $VESA_OK,%al; 366 jnz 0f; 367 368 mov VESA_MODE_PHADDR_OFFSET(%di),%esi; 369 mov VESA_MODE_WIDTH_OFFSET(%di),%ax; 370 shl $16,%eax; 371 mov VESA_MODE_HEIGHT_OFFSET(%di),%ax; 372 mov VESA_MODE_BPP_OFFSET(%di),%bl; 373 xor %bh,%bh; 374 shl $16,%ebx; 375 mov VESA_MODE_SCANLINE_OFFSET(%di),%bx; 376 mov %eax,%edi; 377 378 379 357 358 mov %cx, %bx 359 or $0xc000, %bx 360 push %di 361 mov $VESA_SET_MODE, %ax 362 int $0x10 363 364 pop %di 365 cmp $VESA_OK, %al 366 jnz 0f 367 368 mov VESA_MODE_PHADDR_OFFSET(%di), %esi 369 mov VESA_MODE_WIDTH_OFFSET(%di), %ax 370 shl $16, %eax 371 mov VESA_MODE_HEIGHT_OFFSET(%di), %ax 372 mov VESA_MODE_BPP_OFFSET(%di), %bl 373 xor %bh, %bh 374 shl $16, %ebx 375 mov VESA_MODE_SCANLINE_OFFSET(%di), %bx 376 mov %eax, %edi 377 380 378 8: 381 382 mov %cr0, %eax;383 or $1, %eax;384 mov %eax,%cr0 ;385 386 jmp 9f ;379 380 mov %cr0, %eax 381 or $1, %eax 382 mov %eax,%cr0 383 384 jmp 9f 387 385 9: 388 389 pop %cx; 390 pop %ebp; 391 pop %gs; 392 pop %fs; 393 pop %es; 394 pop %ds; 395 mov %cx,%ss; 396 mov %ebp,%esp; 397 398 ljmpl $KTEXT,$(vesa_init_protect-vesa_init+VESA_INIT_SEGMENT<<4); 399 400 401 0: #Error no Prefered mode found 402 mov $0x111,%cx; 403 push %di; 404 push %cx; 405 mov $VESA_GET_MODE_INFO,%ax; 406 int $0x10; 407 pop %cx; 408 pop %di; 409 cmp $VESA_OK,%al; 410 jnz 1f; 411 jz 2b; /* Force relative jump */ 412 413 1:mov $0x0003,%ax; 414 int $0x10; 415 mov $0xffffffff,%edi; /* EGA text mode used, because of problems with VESA */ 416 xor %ax,%ax 417 jz 8b; /* Force relative jump */ 418 419 vesa_init_protect: 386 387 ljmpl $KTEXT, $(vesa_init_protect - vesa_init + VESA_INIT_SEGMENT << 4) 388 389 0:# No prefered mode found 390 mov $0x111, %cx 391 push %di 392 push %cx 393 mov $VESA_GET_MODE_INFO, %ax 394 int $0x10 395 396 pop %cx 397 pop %di 398 cmp $VESA_OK, %al 399 jnz 1f 400 jz 2b # Force relative jump 401 402 1: 403 mov $0x0003, %ax 404 int $0x10 405 mov $0xffffffff, %edi # EGA text mode used, because of problems with VESA 406 xor %ax, %ax 407 jz 8b # Force relative jump 408 409 420 410 .code32 421 ret; 422 423 vesa_idt: 424 .word 0x03ff 425 .long 0 411 vesa_init_protect: 412 popl %esp 413 414 movw $KDATA, %cx 415 movw %cx, %es 416 movw %cx, %fs 417 movw %cx, %gs 418 movw %cx, %ds # kernel data + stack 419 movw %cx, %ss 420 421 jmpl $KTEXT, $vesa_meeting_point 422 426 423 .align 4 427 424 e_vesa_init:
Note:
See TracChangeset
for help on using the changeset viewer.