Rev 2222 | Rev 2725 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2222 | Rev 2302 | ||
---|---|---|---|
Line 351... | Line 351... | ||
351 | movl $0x0000fffc, %ebp |
351 | movl $0x0000fffc, %ebp |
352 | pushl %eax |
352 | pushl %eax |
353 | 353 | ||
354 | #define VESA_INFO_SIZE 1024 |
354 | #define VESA_INFO_SIZE 1024 |
355 | 355 | ||
- | 356 | #define VESA_MODE_ATTRIBUTES_OFFSET 0 |
|
356 | #define VESA_MODE_LIST_PTR_OFFSET 14 |
357 | #define VESA_MODE_LIST_PTR_OFFSET 14 |
- | 358 | #define VESA_MODE_SCANLINE_OFFSET 16 |
|
357 | #define VESA_MODE_WIDTH_OFFSET 18 |
359 | #define VESA_MODE_WIDTH_OFFSET 18 |
358 | #define VESA_MODE_HEIGHT_OFFSET 20 |
360 | #define VESA_MODE_HEIGHT_OFFSET 20 |
359 | #define VESA_MODE_BPP_OFFSET 25 |
361 | #define VESA_MODE_BPP_OFFSET 25 |
360 | #define VESA_MODE_SCANLINE_OFFSET 16 |
- | |
361 | #define VESA_MODE_PHADDR_OFFSET 40 |
362 | #define VESA_MODE_PHADDR_OFFSET 40 |
362 | 363 | ||
363 | #define VESA_END_OF_MODES 0xffff |
364 | #define VESA_END_OF_MODES 0xffff |
364 | 365 | ||
365 | #define VESA_OK 0x4f |
366 | #define VESA_OK 0x4f |
366 | 367 | ||
367 | #define VESA_GET_INFO 0x4f00 |
368 | #define VESA_GET_INFO 0x4f00 |
368 | #define VESA_GET_MODE_INFO 0x4f01 |
369 | #define VESA_GET_MODE_INFO 0x4f01 |
369 | #define VESA_SET_MODE 0x4f02 |
370 | #define VESA_SET_MODE 0x4f02 |
370 | - | ||
371 | #define CONFIG_VESA_BPP_a 255 |
371 | #define VESA_SET_PALETTE 0x4f09 |
372 | 372 | ||
373 | #if CONFIG_VESA_BPP == 24 |
373 | #if CONFIG_VESA_BPP == 24 |
374 | #undef CONFIG_VESA_BPP_a |
- | |
375 | #define CONFIG_VESA_BPP_a 32 |
374 | #define CONFIG_VESA_BPP_VARIANT 32 |
376 | #endif |
375 | #endif |
377 | 376 | ||
378 | mov $VESA_GET_INFO, %ax |
377 | mov $VESA_GET_INFO, %ax |
379 | mov $e_vesa_init - vesa_init, %di |
378 | mov $e_vesa_init - vesa_init, %di |
380 | push %di |
379 | push %di |
Line 411... | Line 410... | ||
411 | 410 | ||
412 | mov $CONFIG_VESA_WIDTH, %ax |
411 | mov $CONFIG_VESA_WIDTH, %ax |
413 | cmp VESA_MODE_WIDTH_OFFSET(%di), %ax |
412 | cmp VESA_MODE_WIDTH_OFFSET(%di), %ax |
414 | jnz 1b |
413 | jnz 1b |
415 | 414 | ||
416 | mov $CONFIG_VESA_HEIGHT,%ax |
415 | mov $CONFIG_VESA_HEIGHT, %ax |
417 | cmp VESA_MODE_HEIGHT_OFFSET(%di), %ax |
416 | cmp VESA_MODE_HEIGHT_OFFSET(%di), %ax |
418 | jnz 1b |
417 | jnz 1b |
419 | 418 | ||
420 | mov $CONFIG_VESA_BPP, %al |
419 | mov $CONFIG_VESA_BPP, %al |
421 | cmp VESA_MODE_BPP_OFFSET(%di), %al |
420 | cmp VESA_MODE_BPP_OFFSET(%di), %al |
- | 421 | ||
- | 422 | #ifdef CONFIG_VESA_BPP_VARIANT |
|
422 | jz 2f |
423 | jz 2f |
423 | 424 | ||
424 | mov $CONFIG_VESA_BPP_a, %al |
425 | mov $CONFIG_VESA_BPP_VARIANT, %al |
425 | cmp VESA_MODE_BPP_OFFSET(%di), %al |
426 | cmp VESA_MODE_BPP_OFFSET(%di), %al |
- | 427 | #endif |
|
426 | jnz 1b |
428 | jnz 1b |
427 | 429 | ||
428 | 2: |
430 | 2: |
429 | 431 | ||
430 | mov %cx, %bx |
432 | mov %cx, %bx |
431 | or $0xc000, %bx |
433 | or $0xc000, %bx |
432 | push %di |
434 | push %di |
Line 434... | Line 436... | ||
434 | int $0x10 |
436 | int $0x10 |
435 | 437 | ||
436 | pop %di |
438 | pop %di |
437 | cmp $VESA_OK, %al |
439 | cmp $VESA_OK, %al |
438 | jnz 0f |
440 | jnz 0f |
- | 441 | ||
- | 442 | #if CONFIG_VESA_BPP == 8 |
|
- | 443 | ||
- | 444 | # Set 3:2:3 VGA palette |
|
- | 445 | ||
- | 446 | mov VESA_MODE_ATTRIBUTES_OFFSET(%di), %ax |
|
- | 447 | push %di |
|
- | 448 | mov $vga323 - vesa_init, %di |
|
- | 449 | mov $0x100, %ecx |
|
- | 450 | ||
- | 451 | bt $5, %ax # Test if VGA compatible registers are present |
|
- | 452 | jnc vga_compat |
|
- | 453 | ||
- | 454 | # Try VESA routine to set palette |
|
- | 455 | ||
- | 456 | mov $VESA_SET_PALETTE, %ax |
|
- | 457 | xor %bl, %bl |
|
- | 458 | xor %dx, %dx |
|
- | 459 | int $0x10 |
|
- | 460 | ||
- | 461 | jmp vga_not_compat |
|
- | 462 | ||
- | 463 | vga_compat: |
|
- | 464 | ||
- | 465 | # Try VGA registers to set palette |
|
- | 466 | ||
- | 467 | movw $0x3c6, %dx # Set palette mask |
|
- | 468 | movb $0xff, %al |
|
- | 469 | outb %al, %dx |
|
- | 470 | ||
- | 471 | movw $0x3c8, %dx # First index to set |
|
- | 472 | xor %al, %al |
|
- | 473 | outb %al, %dx |
|
- | 474 | ||
- | 475 | movw $0x3c9, %dx # Data port |
|
- | 476 | vga_loop: |
|
- | 477 | movb %es:2(%di), %al |
|
- | 478 | outb %al, %dx |
|
- | 479 | ||
- | 480 | movb %es:1(%di), %al |
|
- | 481 | outb %al, %dx |
|
- | 482 | ||
- | 483 | movb %es:(%di), %al |
|
- | 484 | outb %al, %dx |
|
- | 485 | ||
- | 486 | addw $4, %di |
|
- | 487 | loop vga_loop |
|
- | 488 | ||
- | 489 | vga_not_compat: |
|
- | 490 | ||
- | 491 | pop %di |
|
- | 492 | ||
- | 493 | #endif |
|
439 | 494 | ||
440 | mov VESA_MODE_PHADDR_OFFSET(%di), %esi |
495 | mov VESA_MODE_PHADDR_OFFSET(%di), %esi |
441 | mov VESA_MODE_WIDTH_OFFSET(%di), %ax |
496 | mov VESA_MODE_WIDTH_OFFSET(%di), %ax |
442 | shl $16, %eax |
497 | shl $16, %eax |
443 | mov VESA_MODE_HEIGHT_OFFSET(%di), %ax |
498 | mov VESA_MODE_HEIGHT_OFFSET(%di), %ax |
Line 475... | Line 530... | ||
475 | mov $0x0003, %ax |
530 | mov $0x0003, %ax |
476 | int $0x10 |
531 | int $0x10 |
477 | mov $0xffffffff, %edi # EGA text mode used, because of problems with VESA |
532 | mov $0xffffffff, %edi # EGA text mode used, because of problems with VESA |
478 | xor %ax, %ax |
533 | xor %ax, %ax |
479 | jz 8b # Force relative jump |
534 | jz 8b # Force relative jump |
480 | 535 | ||
- | 536 | vga323: |
|
- | 537 | #include "vga323.pal" |
|
481 | 538 | ||
482 | .code32 |
539 | .code32 |
483 | vesa_init_protect: |
540 | vesa_init_protect: |
484 | movw $selector(KDATA_DES), %cx |
541 | movw $selector(KDATA_DES), %cx |
485 | movw %cx, %es |
542 | movw %cx, %es |
Line 507... | Line 564... | ||
507 | 564 | ||
508 | grub_ebx: |
565 | grub_ebx: |
509 | .long 0 |
566 | .long 0 |
510 | 567 | ||
511 | pse_msg: |
568 | pse_msg: |
512 | .ascii "Page Size Extension not supported. System halted.\0" |
569 | .asciz "Page Size Extension not supported. System halted." |