Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/boot/multiboot.S

    rbae43dc r9a791eb9  
    3838#include <arch/cpu.h>
    3939
     40// TODO: most of this file can be rewritten in C
     41
     42// TODO: FB state should be checked dynamically from provided multiboot info.
     43//       Currently we only enable EGA statically, which forces us to rebuild
     44//       the image to get very early debug output.
     45
    4046#define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
    4147
     
    4450.code32
    4551
    46 .macro pm_error msg
    47         movl \msg, %esi
    48         jmp pm_error_halt
    49 .endm
    50 
    5152.macro pm_status msg
    52 #ifdef CONFIG_EGA
     53#if defined(CONFIG_EGA) && !defined(CONFIG_FB)
    5354        pushl %esi
    5455        movl \msg, %esi
     
    6667multiboot_header:
    6768        .long MULTIBOOT_HEADER_MAGIC
     69#ifdef CONFIG_FB
    6870        .long MULTIBOOT_HEADER_FLAGS
    6971        .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)  /* checksum */
     72#else
     73        .long MULTIBOOT_HEADER_FLAGS_NOFB
     74        .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS_NOFB)  /* checksum */
     75#endif
    7076        .long multiboot_header
    7177        .long unmapped_start
     
    7379        .long 0
    7480        .long multiboot_image_start
     81#ifdef CONFIG_FB
     82        .long 0
     83        .long CONFIG_BFB_WIDTH
     84        .long CONFIG_BFB_HEIGHT
     85        .long CONFIG_BFB_BPP
     86#endif
    7587
    7688SYMBOL(multiboot_image_start)
     
    104116
    105117        pm_status $status_prot
    106 
    107 #include "vesa_prot.inc"
    108118
    109119#ifndef PROCESSOR_i486
     
    356366                        ret
    357367
    358 /** Print string to EGA display (in light red) and halt.
    359  *
    360  * Should be executed from 32 bit protected mode with paging
    361  * turned off. Stack is not required. This routine is used even
    362  * if CONFIG_EGA is not enabled. Since we are going to halt the
    363  * CPU anyway, it is always better to at least try to print
    364  * some hints.
    365  *
    366  * @param %esi NULL-terminated string to print.
    367  *
    368  */
    369 pm_error_halt:
    370         movl $0xb8000, %edi  /* base of EGA text mode memory */
    371         xorl %eax, %eax
    372 
    373         /* Read bits 8 - 15 of the cursor address */
    374         movw $0x3d4, %dx
    375         movb $0xe, %al
    376         outb %al, %dx
    377 
    378         movw $0x3d5, %dx
    379         inb %dx, %al
    380         shl $8, %ax
    381 
    382         /* Read bits 0 - 7 of the cursor address */
    383         movw $0x3d4, %dx
    384         movb $0xf, %al
    385         outb %al, %dx
    386 
    387         movw $0x3d5, %dx
    388         inb %dx, %al
    389 
    390         /* Sanity check for the cursor on screen */
    391         cmp $2000, %ax
    392         jb err_cursor_ok
    393 
    394                 movw $1998, %ax
    395 
    396         err_cursor_ok:
    397 
    398         movw %ax, %bx
    399         shl $1, %eax
    400         addl %eax, %edi
    401 
    402         err_ploop:
    403                 lodsb
    404 
    405                 cmp $0, %al
    406                 je err_ploop_end
    407 
    408                 movb $0x0c, %ah  /* black background, light red foreground */
    409                 stosw
    410 
    411                 /* Sanity check for the cursor on the last line */
    412                 inc %bx
    413                 cmp $2000, %bx
    414                 jb err_ploop
    415 
    416                 /* Scroll the screen (24 rows) */
    417                 movl %esi, %edx
    418                 movl $0xb80a0, %esi
    419                 movl $0xb8000, %edi
    420                 movl $960, %ecx
    421                 rep movsl
    422 
    423                 /* Clear the 24th row */
    424                 xorl %eax, %eax
    425                 movl $40, %ecx
    426                 rep stosl
    427 
    428                 /* Go to row 24 */
    429                 movl %edx, %esi
    430                 movl $0xb8f00, %edi
    431                 movw $1920, %bx
    432 
    433                 jmp err_ploop
    434         err_ploop_end:
    435 
    436         /* Write bits 8 - 15 of the cursor address */
    437         movw $0x3d4, %dx
    438         movb $0xe, %al
    439         outb %al, %dx
    440 
    441         movw $0x3d5, %dx
    442         movb %bh, %al
    443         outb %al, %dx
    444 
    445         /* Write bits 0 - 7 of the cursor address */
    446         movw $0x3d4, %dx
    447         movb $0xf, %al
    448         outb %al, %dx
    449 
    450         movw $0x3d5, %dx
    451         movb %bl, %al
    452         outb %al, %dx
    453 
    454         cli
    455         hlt1:
    456                 hlt
    457                 jmp hlt1
    458 
    459368/** Print string to EGA display (in light green).
    460369 *
     
    685594        ret
    686595
    687 #include "vesa_real.inc"
    688 
    689596.section K_DATA_START, "aw", @progbits
    690597
     
    720627status_non_pse:
    721628        .asciz "[non_pse] "
    722 status_vesa_copy:
    723         .asciz "[vesa_copy] "
    724629status_multiboot_cmdline:
    725630        .asciz "[multiboot_cmdline] "
    726 status_vesa_real:
    727         .asciz "[vesa_real] "
    728631status_prot2:
    729632        .asciz "[prot2] "
Note: See TracChangeset for help on using the changeset viewer.