summaryrefslogtreecommitdiff
path: root/kernel/multiboot.c
blob: 7f4509339db252ae45d2795bbf10c28ccc9731c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "kernel.h"
#include "multiboot.h"

multiboot_information* multiboot_read(uint32_t eax, uint32_t ebx, bool silent)
{
    if(eax!=0x2badb002)kpanic("EAX was not set properly by your bootlaoder!");

    multiboot_information *info;
    info=ebx;
    if(silent) return info; // silence is golden

    klog("multiboot struct at addr: 0x%08X",ebx);

    klog("multiboot flags: 0x%08X",info->flags);

    if(info->flags&&1<<0)
    {
	klog("[0] mem_lower: %d KB",info->mem_lower);
	klog("[0] mem_upper: %d KB",info->mem_upper);
    }

    if(info->flags&&1<<1)
    {
	klog("[1] boot-device 0x%08X",info->boot_device);
    }

    if(info->flags&&1<<2)
    {
	klog("[2] cmdline: \"%s\"",info->cmdline);
    }

    if(info->flags&&1<<3)
    {
	klog("[3] loaded modules count: %d",info->mods_count);
    }

    if(info->flags&&1<<4)
    {
	klog("[4/5] a.out kernel image symbols found");
    }

    if(info->flags&&1<<5)
    {
	klog("[4/5] ELF table: %d entries (sized %d) at 0x%08X with strings at %d",info->syms[0],info->syms[1],info->syms[2],info->syms[3]);
    }

    if(info->flags&&1<<6)
    {
	klog("[6] Found memory map");
    }

    if(info->flags&&1<<7)
    {
	klog("[7] Found Drives map");
    }

    if(info->flags&&1<<8)
    {
	klog("[8] ROM Configuration Table at: 0x%08X",info->config_table);
    }

    if(info->flags&&1<<9)
    {
	klog("[9] Loaded by: \"%s\"",info->boot_loader_name);
    }

    if(info->flags&&1<<10)
    {
	klog("[10] APM Table present.");
    }

    if(info->flags&&1<<11)
    {
	klog("[11] VBE control info: 0x%08X",info->vbe_control_info);
	klog("[11] VBE mode info: 0x%08X",info->vbe_mode_info);
	klog("[11] VBE current mode (spec V3.0): 0x%08X",info->vbe_mode);
    }

    if(info->flags&&1<<12)
    {
	klog("[12] Framebuffer (type=%d) (w:%d h:%d bpp:%d) at addr=0x%08X",info->framebuffer_type,info->framebuffer_width,info->framebuffer_height,info->framebuffer_bpp,info->framebuffer_addr);
    }

    return info;
}