Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset e3fa1720 in mainline


Ignore:
Timestamp:
2018-11-13T20:14:30Z (3 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master
Children:
2214382, 64f85f5
Parents:
6ae5e3f (diff), 9a791eb9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-13 20:14:30)
git-committer:
GitHub <noreply@…> (2018-11-13 20:14:30)
Message:

Remove realmode VESA code (#59)

Enables framebuffer initialization via multiboot1(multiboot2 already did it), and removes the obsolete code. Then deduplicates code for the two multiboots.

Files:
8 deleted
8 edited

Legend:

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

    r6ae5e3f re3fa1720  
    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
     
    5056
    5157.macro pm_status msg
    52 #ifdef CONFIG_EGA
     58#if defined(CONFIG_EGA) && !defined(CONFIG_FB)
    5359        pushl %esi
    5460        movl \msg, %esi
     
    6773multiboot_header:
    6874        .long MULTIBOOT_HEADER_MAGIC
     75#ifdef CONFIG_FB
    6976        .long MULTIBOOT_HEADER_FLAGS
    7077        .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)  /* checksum */
     78#else
     79        .long MULTIBOOT_HEADER_FLAGS_NOFB
     80        .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS_NOFB)  /* checksum */
     81#endif
    7182        .long multiboot_header
    7283        .long unmapped_start
     
    7485        .long 0
    7586        .long multiboot_image_start
     87#ifdef CONFIG_FB
     88        .long 0
     89        .long CONFIG_BFB_WIDTH
     90        .long CONFIG_BFB_HEIGHT
     91        .long CONFIG_BFB_BPP
     92#endif
    7693
    7794SYMBOL(multiboot_image_start)
     
    158175        sse2_supported:
    159176
    160 #include "vesa_prot.inc"
    161 
    162177        pm2_status $status_prot2
    163178
     
    568583
    569584        ret
    570 
    571 #include "vesa_real.inc"
    572585
    573586.section K_INI_PTLS, "aw", @progbits
     
    708721status_prot:
    709722        .asciz "[prot] "
    710 status_vesa_copy:
    711         .asciz "[vesa_copy] "
    712723status_multiboot_cmdline:
    713724        .asciz "[multiboot_cmdline] "
    714 status_vesa_real:
    715         .asciz "[vesa_real] "
    716725status_prot2:
    717726        .asciz "[prot2] "
  • kernel/arch/amd64/src/boot/multiboot2.S

    r6ae5e3f re3fa1720  
    3434#include <arch/cpu.h>
    3535#include <genarch/multiboot/multiboot2.h>
    36 
    37 #define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
    3836
    3937.section K_TEXT_START, "ax"
     
    8078                .word MULTIBOOT2_FLAGS_REQUIRED
    8179                .long tag_entry_address_end - tag_entry_address_start
    82                 .long multiboot2_image_start
     80                .long multiboot_image_start
    8381        tag_entry_address_end:
    8482
     
    122120        tag_terminator_end:
    123121multiboot2_header_end:
    124 
    125 SYMBOL(multiboot2_image_start)
    126         cli
    127         cld
    128 
    129         /* Initialize stack pointer */
    130         movl $START_STACK, %esp
    131 
    132         /*
    133          * Initialize Global Descriptor Table and
    134          * Interrupt Descriptor Table registers
    135          */
    136         lgdtl bootstrap_gdtr
    137         lidtl bootstrap_idtr
    138 
    139         /* Kernel data + stack */
    140         movw $GDT_SELECTOR(KDATA_DES), %cx
    141         movw %cx, %es
    142         movw %cx, %ds
    143         movw %cx, %ss
    144 
    145         /*
    146          * Simics seems to remove hidden part of GS on entering user mode
    147          * when _visible_ part of GS does not point to user-mode segment.
    148          */
    149         movw $GDT_SELECTOR(UDATA_DES), %cx
    150         movw %cx, %fs
    151         movw %cx, %gs
    152 
    153         jmpl $GDT_SELECTOR(KTEXT32_DES), $multiboot2_meeting_point
    154         multiboot2_meeting_point:
    155 
    156         /*
    157          * Protected 32-bit. We want to reuse the code-seg descriptor,
    158          * the Default operand size must not be 1 when entering long mode.
    159          */
    160 
    161         /* Save multiboot arguments */
    162         movl %eax, multiboot_eax
    163         movl %ebx, multiboot_ebx
    164 
    165         movl $(INTEL_CPUID_EXTENDED), %eax
    166         cpuid
    167         cmp $(INTEL_CPUID_EXTENDED), %eax
    168         ja extended_cpuid_supported
    169 
    170                 jmp pm_error_halt
    171 
    172         extended_cpuid_supported:
    173 
    174         movl $(AMD_CPUID_EXTENDED), %eax
    175         cpuid
    176         bt $(AMD_EXT_LONG_MODE), %edx
    177         jc long_mode_supported
    178 
    179                 jmp pm_error_halt
    180 
    181         long_mode_supported:
    182 
    183         bt $(AMD_EXT_NOEXECUTE), %edx
    184         jc noexecute_supported
    185 
    186                 jmp pm_error_halt
    187 
    188         noexecute_supported:
    189 
    190         movl $(INTEL_CPUID_STANDARD), %eax
    191         cpuid
    192         bt $(INTEL_FXSAVE), %edx
    193         jc fx_supported
    194 
    195                 jmp pm_error_halt
    196 
    197         fx_supported:
    198 
    199         bt $(INTEL_SSE2), %edx
    200         jc sse2_supported
    201 
    202                 jmp pm_error_halt
    203 
    204         sse2_supported:
    205 
    206         /*
    207          * Enable 64-bit page translation entries - CR4.PAE = 1.
    208          * Paging is not enabled until after long mode is enabled.
    209          */
    210 
    211         movl %cr4, %eax
    212         orl $CR4_PAE, %eax
    213         movl %eax, %cr4
    214 
    215         /* Set up paging tables */
    216         leal ptl_0, %eax
    217         movl %eax, %cr3
    218 
    219         /* Enable long mode */
    220         movl $AMD_MSR_EFER, %ecx
    221         rdmsr                     /* read EFER */
    222         orl $AMD_LME, %eax        /* set LME = 1 */
    223         wrmsr
    224 
    225         /* Enable paging to activate long mode (set CR0.PG = 1) */
    226         movl %cr0, %eax
    227         orl $CR0_PG, %eax
    228         movl %eax, %cr0
    229 
    230         /* At this point we are in compatibility mode */
    231         jmpl $GDT_SELECTOR(KTEXT_DES), $start64
    232 
    233 pm_error_halt:
    234         cli
    235         hlt1:
    236                 hlt
    237                 jmp hlt1
    238 
    239 .code64
    240 
    241 start64:
    242 
    243         /*
    244          * Long mode.
    245          */
    246 
    247         movq $(PA2KA(START_STACK)), %rsp
    248 
    249         /* Create the first stack frame */
    250         pushq $0
    251         movq %rsp, %rbp
    252 
    253         /* Call amd64_pre_main(multiboot_eax, multiboot_ebx) */
    254         movl multiboot_eax, %edi
    255         movl multiboot_ebx, %esi
    256 
    257 #ifdef MEMORY_MODEL_large
    258         movabsq $amd64_pre_main, %rax
    259         callq *%rax
    260 #else
    261         callq amd64_pre_main
    262 #endif
    263 
    264         /* Call main_bsp() */
    265 #ifdef MEMORY_MODEL_large
    266         movabsq $main_bsp, %rax
    267         callq *%rax
    268 #else
    269         callq main_bsp
    270 #endif
    271 
    272         /* Not reached */
    273         cli
    274         hlt0:
    275                 hlt
    276                 jmp hlt0
  • kernel/arch/ia32/src/boot/multiboot.S

    r6ae5e3f re3fa1720  
    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] "
  • kernel/arch/ia32/src/boot/multiboot2.S

    r6ae5e3f re3fa1720  
    3232#include <arch/cpuid.h>
    3333#include <genarch/multiboot/multiboot2.h>
    34 
    35 #define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
    3634
    3735.section K_TEXT_START, "ax"
     
    7876                .word MULTIBOOT2_FLAGS_REQUIRED
    7977                .long tag_entry_address_end - tag_entry_address_start
    80                 .long multiboot2_image_start
     78                .long multiboot_image_start
    8179        tag_entry_address_end:
    8280
     
    120118        tag_terminator_end:
    121119multiboot2_header_end:
    122 
    123 SYMBOL(multiboot2_image_start)
    124         cli
    125         cld
    126 
    127         /* Initialize stack pointer */
    128         movl $START_STACK, %esp
    129 
    130         /*
    131          * Initialize Global Descriptor Table and
    132          * Interrupt Descriptor Table registers
    133          */
    134         lgdtl bootstrap_gdtr
    135         lidtl bootstrap_idtr
    136 
    137         /* Kernel data + stack */
    138         movw $GDT_SELECTOR(KDATA_DES), %cx
    139         movw %cx, %es
    140         movw %cx, %fs
    141         movw %cx, %gs
    142         movw %cx, %ds
    143         movw %cx, %ss
    144 
    145         jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot2_meeting_point
    146         multiboot2_meeting_point:
    147 
    148         /* Save multiboot arguments */
    149         movl %eax, multiboot_eax
    150         movl %ebx, multiboot_ebx
    151 
    152 #ifndef PROCESSOR_i486
    153 
    154         movl $(INTEL_CPUID_LEVEL), %eax
    155         cpuid
    156         cmp $0x0, %eax  /* any function > 0? */
    157         jbe pse_unsupported
    158 
    159         movl $(INTEL_CPUID_STANDARD), %eax
    160         cpuid
    161         bt $(INTEL_PSE), %edx
    162         jnc pse_unsupported
    163 
    164                 /* Map kernel and turn paging on */
    165                 call map_kernel_pse
    166                 jmp stack_init
    167 
    168 #endif /* PROCESSOR_i486 */
    169 
    170         pse_unsupported:
    171 
    172                 /* Map kernel and turn paging on */
    173                 call map_kernel_non_pse
    174 
    175         stack_init:
    176 
    177         /* Create the first stack frame */
    178         pushl $0
    179         movl %esp, %ebp
    180 
    181         /* Call ia32_pre_main(multiboot_eax, multiboot_ebx) */
    182         pushl multiboot_ebx
    183         pushl multiboot_eax
    184         call ia32_pre_main
    185 
    186         /* Call main_bsp() */
    187         call main_bsp
    188 
    189         /* Not reached */
    190         cli
    191         hlt0:
    192                 hlt
    193                 jmp hlt0
  • kernel/genarch/include/genarch/multiboot/multiboot.h

    r6ae5e3f re3fa1720  
    3939#include <genarch/multiboot/multiboot_info_struct.h>
    4040
    41 #define MULTIBOOT_HEADER_MAGIC  0x1badb002
    42 #define MULTIBOOT_HEADER_FLAGS  0x00010003
     41#define MULTIBOOT_HEADER_MAGIC       0x1badb002
     42#define MULTIBOOT_HEADER_FLAGS       0x00010007
     43#define MULTIBOOT_HEADER_FLAGS_NOFB  0x00010003
    4344
    4445#define MULTIBOOT_LOADER_MAGIC  0x2badb002
    4546
    46 #define MULTIBOOT_INFO_FLAGS_MEM        0x01
    47 #define MULTIBOOT_INFO_FLAGS_BOOT       0x02
    48 #define MULTIBOOT_INFO_FLAGS_CMDLINE    0x04
    49 #define MULTIBOOT_INFO_FLAGS_MODS       0x08
    50 #define MULTIBOOT_INFO_FLAGS_SYMS1      0x10
    51 #define MULTIBOOT_INFO_FLAGS_SYMS2      0x20
    52 #define MULTIBOOT_INFO_FLAGS_MMAP       0x40
     47#define MULTIBOOT_INFO_FLAGS_MEM               0x0001
     48#define MULTIBOOT_INFO_FLAGS_BOOT              0x0002
     49#define MULTIBOOT_INFO_FLAGS_CMDLINE           0x0004
     50#define MULTIBOOT_INFO_FLAGS_MODS              0x0008
     51#define MULTIBOOT_INFO_FLAGS_SYMS_AOUT         0x0010
     52#define MULTIBOOT_INFO_FLAGS_SYMS_ELF          0x0020
     53#define MULTIBOOT_INFO_FLAGS_MMAP              0x0040
     54#define MULTIBOOT_INFO_FLAGS_DRIVES            0x0080
     55#define MULTIBOOT_INFO_FLAGS_CONFIG_TABLE      0x0100
     56#define MULTIBOOT_INFO_FLAGS_BOOT_LOADER_NAME  0x0200
     57#define MULTIBOOT_INFO_FLAGS_APM               0x0400
     58#define MULTIBOOT_INFO_FLAGS_VBE               0x0800
     59#define MULTIBOOT_INFO_FLAGS_FB                0x1000
    5360
    5461#ifndef __ASSEMBLER__
  • kernel/genarch/include/genarch/multiboot/multiboot_info_struct.h

    r6ae5e3f re3fa1720  
    3030#define KERN_MULTIBOOT_INFO_STRUCT_H_
    3131
    32 #define MULTIBOOT_INFO_OFFSET_FLAGS        0x00
    33 #define MULTIBOOT_INFO_OFFSET_MEM_LOWER    0x04
    34 #define MULTIBOOT_INFO_OFFSET_MEM_UPPER    0x08
    35 #define MULTIBOOT_INFO_OFFSET_BOOT_DEVICE  0x0c
    36 #define MULTIBOOT_INFO_OFFSET_CMD_LINE     0x10
    37 #define MULTIBOOT_INFO_OFFSET_MODS_COUNT   0x14
    38 #define MULTIBOOT_INFO_OFFSET_MODS_ADDR    0x18
    39 #define MULTIBOOT_INFO_OFFSET_SYMS         0x1c
    40 #define MULTIBOOT_INFO_OFFSET_MMAP_LENGTH  0x2c
    41 #define MULTIBOOT_INFO_OFFSET_MMAP_ADDR    0x30
    42 #define MULTIBOOT_INFO_SIZE                0x34
     32#define MULTIBOOT_INFO_OFFSET_FLAGS               0x00
     33#define MULTIBOOT_INFO_OFFSET_MEM_LOWER           0x04
     34#define MULTIBOOT_INFO_OFFSET_MEM_UPPER           0x08
     35#define MULTIBOOT_INFO_OFFSET_BOOT_DEVICE         0x0c
     36#define MULTIBOOT_INFO_OFFSET_CMD_LINE            0x10
     37#define MULTIBOOT_INFO_OFFSET_MODS_COUNT          0x14
     38#define MULTIBOOT_INFO_OFFSET_MODS_ADDR           0x18
     39#define MULTIBOOT_INFO_OFFSET_SYMS                0x1c
     40#define MULTIBOOT_INFO_OFFSET_MMAP_LENGTH         0x2c
     41#define MULTIBOOT_INFO_OFFSET_MMAP_ADDR           0x30
     42#define MULTIBOOT_INFO_OFFSET_DRIVES_LENGTH       0x34
     43#define MULTIBOOT_INFO_OFFSET_DRIVES_ADDR         0x38
     44#define MULTIBOOT_INFO_OFFSET_CONFIG_TABLE        0x3c
     45#define MULTIBOOT_INFO_OFFSET_BOOT_LOADER_NAME    0x40
     46#define MULTIBOOT_INFO_OFFSET_APM_TABLE           0x44
     47#define MULTIBOOT_INFO_OFFSET_VBE_CONTROL_INFO    0x48
     48#define MULTIBOOT_INFO_OFFSET_VBE_MODE_INFO       0x4c
     49#define MULTIBOOT_INFO_OFFSET_VBE_MODE            0x50
     50#define MULTIBOOT_INFO_OFFSET_VBE_INTERFACE_SEG   0x52
     51#define MULTIBOOT_INFO_OFFSET_VBE_INTERFACE_OFF   0x54
     52#define MULTIBOOT_INFO_OFFSET_VBE_INTERFACE_LEN   0x56
     53#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_ADDR    0x58
     54#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_PITCH   0x60
     55#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_WIDTH   0x64
     56#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_HEIGHT  0x68
     57#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_BPP     0x6c
     58#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_TYPE    0x6d
     59
     60#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_PALETTE_ADDR          0x6e
     61#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_PALETTE_NUM_COLORS    0x72
     62
     63#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_RED_FIELD_POSITION    0x6e
     64#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_RED_MASK_SIZE         0x6f
     65#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_GREEN_FIELD_POSITION  0x70
     66#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_GREEN_MASK_SIZE       0x71
     67#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_BLUE_FIELD_POSITION   0x72
     68#define MULTIBOOT_INFO_OFFSET_FRAMEBUFFER_BLUE_MASK_SIZE        0x73
     69
     70#define MULTIBOOT_INFO_SIZE                0x76
    4371
    4472#ifndef __ASSEMBLER__
     
    5785        uint32_t mmap_length;
    5886        uint32_t mmap_addr;
     87        uint32_t drives_length;
     88        uint32_t drives_addr;
     89        uint32_t config_table;
     90        uint32_t boot_loader_name;
     91        uint32_t apm_table;
     92        uint32_t vbe_control_info;
     93        uint32_t vbe_mode_info;
     94        uint16_t vbe_mode;
     95        uint16_t vbe_interface_seg;
     96        uint16_t vbe_interface_off;
     97        uint16_t vbe_interface_len;
     98        uint64_t framebuffer_addr;
     99        uint32_t framebuffer_pitch;
     100        uint32_t framebuffer_width;
     101        uint32_t framebuffer_height;
     102        uint8_t framebuffer_bpp;
     103        uint8_t framebuffer_type;
     104        union {
     105                struct {
     106                        uint32_t framebuffer_palette_addr;
     107                        uint32_t framebuffer_palette_num_colors;
     108                } __attribute__((packed));
     109                struct {
     110                        uint8_t framebuffer_red_field_position;
     111                        uint8_t framebuffer_red_mask_size;
     112                        uint8_t framebuffer_green_field_position;
     113                        uint8_t framebuffer_green_mask_size;
     114                        uint8_t framebuffer_blue_field_position;
     115                        uint8_t framebuffer_blue_mask_size;
     116                } __attribute__((packed));
     117        } __attribute__((packed));
    59118} __attribute__((packed)) multiboot_info_t;
    60119
  • kernel/genarch/src/multiboot/multiboot.c

    r6ae5e3f re3fa1720  
    3535#include <typedefs.h>
    3636#include <genarch/multiboot/multiboot.h>
     37#include <genarch/fb/bfb.h>
    3738#include <config.h>
    3839#include <stddef.h>
     
    168169                multiboot_memmap(info->mmap_length,
    169170                    (multiboot_memmap_t *) MULTIBOOT_PTR(info->mmap_addr));
     171
     172#ifdef CONFIG_FB
     173
     174        /* Initialize framebuffer. */
     175        if ((info->flags & MULTIBOOT_INFO_FLAGS_FB) != 0) {
     176                if (info->framebuffer_type != 1) {
     177                        /* Can't use this framebuffer. */
     178                        // FIXME: framebuffer_type == 2 is EGA mode, we should be able to use that.
     179                        return;
     180                }
     181
     182                bfb_addr = info->framebuffer_addr;
     183                bfb_width = info->framebuffer_width;
     184                bfb_height = info->framebuffer_height;
     185                bfb_bpp = info->framebuffer_bpp;
     186                bfb_scanline = info->framebuffer_pitch;
     187                bfb_red_pos = info->framebuffer_red_field_position;
     188                bfb_red_size = info->framebuffer_red_mask_size;
     189                bfb_green_pos = info->framebuffer_green_field_position;
     190                bfb_green_size = info->framebuffer_green_mask_size;
     191                bfb_blue_pos = info->framebuffer_blue_field_position;
     192                bfb_blue_size = info->framebuffer_blue_mask_size;
     193        }
     194
     195#endif
    170196}
    171197
  • tools/autocheck.awk

    r6ae5e3f re3fa1720  
    3838
    3939/}.*;/ {
    40         pattern = "}( __attribute__\\(.*\\))? (" struct_name "_t)?;"
    41         if ($0 !~ pattern) {
    42                 print("Bad struct ending: " $0) > "/dev/stderr"
    43                 exit 1
     40        pattern = "}( __attribute__\\(.*\\))? " struct_name "_t;"
     41        if ($0 ~ pattern) {
     42                macro_name = toupper(struct_name) "_SIZE"
     43                print "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
     44                struct_name = ""
    4445        }
    45         macro_name = toupper(struct_name) "_SIZE"
    46         print "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
    47         struct_name = ""
    4846}
    4947
    5048/;$/ {
    51         if (struct_name != "") {
     49        if (struct_name != "" && $0 !~ "}") {
    5250                # Remove array subscript, if any.
    5351                sub("(\\[.*\\])?;", "", $0)
Note: See TracChangeset for help on using the changeset viewer.