Rev 2222 | Rev 2703 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2222 | Rev 2302 | ||
---|---|---|---|
Line 301... | Line 301... | ||
301 | movl $0x0000fffc, %esp |
301 | movl $0x0000fffc, %esp |
302 | movl $0x0000fffc, %ebp |
302 | movl $0x0000fffc, %ebp |
303 | 303 | ||
304 | #define VESA_INFO_SIZE 1024 |
304 | #define VESA_INFO_SIZE 1024 |
305 | 305 | ||
- | 306 | #define VESA_MODE_ATTRIBUTES_OFFSET 0 |
|
306 | #define VESA_MODE_LIST_PTR_OFFSET 14 |
307 | #define VESA_MODE_LIST_PTR_OFFSET 14 |
- | 308 | #define VESA_MODE_SCANLINE_OFFSET 16 |
|
307 | #define VESA_MODE_WIDTH_OFFSET 18 |
309 | #define VESA_MODE_WIDTH_OFFSET 18 |
308 | #define VESA_MODE_HEIGHT_OFFSET 20 |
310 | #define VESA_MODE_HEIGHT_OFFSET 20 |
309 | #define VESA_MODE_BPP_OFFSET 25 |
311 | #define VESA_MODE_BPP_OFFSET 25 |
310 | #define VESA_MODE_SCANLINE_OFFSET 16 |
- | |
311 | #define VESA_MODE_PHADDR_OFFSET 40 |
312 | #define VESA_MODE_PHADDR_OFFSET 40 |
312 | 313 | ||
313 | #define VESA_END_OF_MODES 0xffff |
314 | #define VESA_END_OF_MODES 0xffff |
314 | 315 | ||
315 | #define VESA_OK 0x4f |
316 | #define VESA_OK 0x4f |
316 | 317 | ||
317 | #define VESA_GET_INFO 0x4f00 |
318 | #define VESA_GET_INFO 0x4f00 |
318 | #define VESA_GET_MODE_INFO 0x4f01 |
319 | #define VESA_GET_MODE_INFO 0x4f01 |
319 | #define VESA_SET_MODE 0x4f02 |
320 | #define VESA_SET_MODE 0x4f02 |
- | 321 | #define VESA_SET_PALETTE 0x4f09 |
|
320 | 322 | ||
321 | #define CONFIG_VESA_BPP_a 255 |
323 | #define CONFIG_VESA_BPP_a 255 |
322 | 324 | ||
323 | #if CONFIG_VESA_BPP == 24 |
325 | #if CONFIG_VESA_BPP == 24 |
324 | #undef CONFIG_VESA_BPP_a |
- | |
325 | #define CONFIG_VESA_BPP_a 32 |
326 | #define CONFIG_VESA_BPP_VARIANT 32 |
326 | #endif |
327 | #endif |
327 | 328 | ||
328 | mov $VESA_GET_INFO, %ax |
329 | mov $VESA_GET_INFO, %ax |
329 | mov $e_vesa_init - vesa_init, %di |
330 | mov $e_vesa_init - vesa_init, %di |
330 | push %di |
331 | push %di |
331 | int $0x10 |
332 | int $0x10 |
332 | 333 | ||
Line 337... | Line 338... | ||
337 | mov 2 + VESA_MODE_LIST_PTR_OFFSET(%di), %si |
338 | mov 2 + VESA_MODE_LIST_PTR_OFFSET(%di), %si |
338 | mov %si, %gs |
339 | mov %si, %gs |
339 | mov VESA_MODE_LIST_PTR_OFFSET(%di), %si |
340 | mov VESA_MODE_LIST_PTR_OFFSET(%di), %si |
340 | 341 | ||
341 | add $VESA_INFO_SIZE, %di |
342 | add $VESA_INFO_SIZE, %di |
342 | 343 | ||
343 | 1:# Try next mode |
344 | 1:# Try next mode |
344 | mov %gs:(%si), %cx |
345 | mov %gs:(%si), %cx |
345 | cmp $VESA_END_OF_MODES, %cx |
346 | cmp $VESA_END_OF_MODES, %cx |
346 | jz 0f |
347 | jz 0f |
347 | 348 | ||
Line 367... | Line 368... | ||
367 | cmp VESA_MODE_HEIGHT_OFFSET(%di), %ax |
368 | cmp VESA_MODE_HEIGHT_OFFSET(%di), %ax |
368 | jnz 1b |
369 | jnz 1b |
369 | 370 | ||
370 | mov $CONFIG_VESA_BPP, %al |
371 | mov $CONFIG_VESA_BPP, %al |
371 | cmp VESA_MODE_BPP_OFFSET(%di), %al |
372 | cmp VESA_MODE_BPP_OFFSET(%di), %al |
- | 373 | ||
- | 374 | #ifdef CONFIG_VESA_BPP_VARIANT |
|
372 | jz 2f |
375 | jz 2f |
373 | 376 | ||
374 | mov $CONFIG_VESA_BPP_a, %al |
377 | mov $CONFIG_VESA_BPP_VARIANT, %al |
375 | cmp VESA_MODE_BPP_OFFSET(%di), %al |
378 | cmp VESA_MODE_BPP_OFFSET(%di), %al |
- | 379 | #endif |
|
376 | jnz 1b |
380 | jnz 1b |
377 | 381 | ||
378 | 2: |
382 | 2: |
379 | 383 | ||
380 | mov %cx, %bx |
384 | mov %cx, %bx |
Line 384... | Line 388... | ||
384 | int $0x10 |
388 | int $0x10 |
385 | 389 | ||
386 | pop %di |
390 | pop %di |
387 | cmp $VESA_OK, %al |
391 | cmp $VESA_OK, %al |
388 | jnz 0f |
392 | jnz 0f |
- | 393 | ||
- | 394 | #if CONFIG_VESA_BPP == 8 |
|
- | 395 | ||
- | 396 | # Set 3:2:3 VGA palette |
|
- | 397 | ||
- | 398 | mov VESA_MODE_ATTRIBUTES_OFFSET(%di), %ax |
|
- | 399 | push %di |
|
- | 400 | mov $vga323 - vesa_init, %di |
|
- | 401 | mov $0x100, %ecx |
|
- | 402 | ||
- | 403 | bt $5, %ax # Test if VGA compatible registers are present |
|
- | 404 | jnc vga_compat |
|
- | 405 | ||
- | 406 | # Try VESA routine to set palette |
|
- | 407 | ||
- | 408 | mov $VESA_SET_PALETTE, %ax |
|
- | 409 | xor %bl, %bl |
|
- | 410 | xor %dx, %dx |
|
- | 411 | int $0x10 |
|
- | 412 | ||
- | 413 | jmp vga_not_compat |
|
- | 414 | ||
- | 415 | vga_compat: |
|
- | 416 | ||
- | 417 | # Try VGA registers to set palette |
|
- | 418 | ||
- | 419 | movw $0x3c6, %dx # Set palette mask |
|
- | 420 | movb $0xff, %al |
|
- | 421 | outb %al, %dx |
|
- | 422 | ||
- | 423 | movw $0x3c8, %dx # First index to set |
|
- | 424 | xor %al, %al |
|
- | 425 | outb %al, %dx |
|
- | 426 | ||
- | 427 | movw $0x3c9, %dx # Data port |
|
- | 428 | vga_loop: |
|
- | 429 | movb %es:2(%di), %al |
|
- | 430 | outb %al, %dx |
|
- | 431 | ||
- | 432 | movb %es:1(%di), %al |
|
- | 433 | outb %al, %dx |
|
- | 434 | ||
- | 435 | movb %es:(%di), %al |
|
- | 436 | outb %al, %dx |
|
- | 437 | ||
- | 438 | addw $4, %di |
|
- | 439 | loop vga_loop |
|
- | 440 | ||
- | 441 | vga_not_compat: |
|
- | 442 | ||
- | 443 | pop %di |
|
- | 444 | ||
- | 445 | #endif |
|
389 | 446 | ||
390 | mov VESA_MODE_PHADDR_OFFSET(%di), %esi |
447 | mov VESA_MODE_PHADDR_OFFSET(%di), %esi |
391 | mov VESA_MODE_WIDTH_OFFSET(%di), %ax |
448 | mov VESA_MODE_WIDTH_OFFSET(%di), %ax |
392 | shl $16, %eax |
449 | shl $16, %eax |
393 | mov VESA_MODE_HEIGHT_OFFSET(%di), %ax |
450 | mov VESA_MODE_HEIGHT_OFFSET(%di), %ax |
Line 425... | Line 482... | ||
425 | mov $0x0003, %ax |
482 | mov $0x0003, %ax |
426 | int $0x10 |
483 | int $0x10 |
427 | mov $0xffffffff, %edi # EGA text mode used, because of problems with VESA |
484 | mov $0xffffffff, %edi # EGA text mode used, because of problems with VESA |
428 | xor %ax, %ax |
485 | xor %ax, %ax |
429 | jz 8b # Force relative jump |
486 | jz 8b # Force relative jump |
430 | 487 | ||
- | 488 | vga323: |
|
- | 489 | #include "vga323.pal" |
|
431 | 490 | ||
432 | .code32 |
491 | .code32 |
433 | vesa_init_protect: |
492 | vesa_init_protect: |
434 | movw $gdtselector(KDATA_DES), %cx |
493 | movw $gdtselector(KDATA_DES), %cx |
435 | movw %cx, %es |
494 | movw %cx, %es |
Line 575... | Line 634... | ||
575 | 634 | ||
576 | grub_ebx: |
635 | grub_ebx: |
577 | .long 0 |
636 | .long 0 |
578 | 637 | ||
579 | long_mode_msg: |
638 | long_mode_msg: |
580 | .ascii "64 bit long mode not supported. System halted.\0" |
639 | .asciz "64 bit long mode not supported. System halted." |