summaryrefslogtreecommitdiff
path: root/src/kernel.c
blob: 2c2afcc19ec193d38c742b42eac4f025fe784b27 (plain) (blame)
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
#include "utils.h"
#include "multiboot.h"
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

void validate_multiboot

void cmain(void) {
    uint32_t magic_response;
    multiboot_info_t* p_multiboot_info;
    asm("\t movl %%eax,%0" : "=r"(magic_response));
    asm("\t movl %%ebx,%0" : "=r"(p_multiboot_info));

    macaroni_assert(magic_response == 0x2BADB002, "im not a bad boo twooo");
    macaroni_assert(p_multiboot_info->framebuffer_width == 640, "not gods width");
    macaroni_assert(p_multiboot_info->framebuffer_height == 480, "not gods height");
    macaroni_assert(p_multiboot_info->framebuffer_bpp == 16, "not gods bpp");
    macaroni_assert(p_multiboot_info->framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB, "not gods fbtype");
    macaroni_assert(p_multiboot_info->framebuffer_red_field_position == 1, "bpp not formatted correctly");

    void *fb = (void *) (unsigned long) p_multiboot_info->framebuffer_addr;
    uint8_t* pixel = fb;
    for (int i = 0; i < 10000; i++) {
        *(pixel + i) = i * 2;
    }

}