Ignore:
File:
1 edited

Legend:

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

    r9a791eb9 rbae43dc  
    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 
    4640#define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
    4741
     
    5044.code32
    5145
     46.macro pm_error msg
     47        movl \msg, %esi
     48        jmp pm_error_halt
     49.endm
     50
    5251.macro pm_status msg
    53 #if defined(CONFIG_EGA) && !defined(CONFIG_FB)
     52#ifdef CONFIG_EGA
    5453        pushl %esi
    5554        movl \msg, %esi
     
    6766multiboot_header:
    6867        .long MULTIBOOT_HEADER_MAGIC
    69 #ifdef CONFIG_FB
    7068        .long MULTIBOOT_HEADER_FLAGS
    7169        .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
    7670        .long multiboot_header
    7771        .long unmapped_start
     
    7973        .long 0
    8074        .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
    8775
    8876SYMBOL(multiboot_image_start)
     
    116104
    117105        pm_status $status_prot
     106
     107#include "vesa_prot.inc"
    118108
    119109#ifndef PROCESSOR_i486
     
    366356                        ret
    367357
     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 */
     369pm_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
    368459/** Print string to EGA display (in light green).
    369460 *
     
    594685        ret
    595686
     687#include "vesa_real.inc"
     688
    596689.section K_DATA_START, "aw", @progbits
    597690
     
    627720status_non_pse:
    628721        .asciz "[non_pse] "
     722status_vesa_copy:
     723        .asciz "[vesa_copy] "
    629724status_multiboot_cmdline:
    630725        .asciz "[multiboot_cmdline] "
     726status_vesa_real:
     727        .asciz "[vesa_real] "
    631728status_prot2:
    632729        .asciz "[prot2] "
Note: See TracChangeset for help on using the changeset viewer.