60 lines
1.6 KiB
C
60 lines
1.6 KiB
C
#include "alloc.h"
|
|
#include "debug.h"
|
|
#include "drivers.h"
|
|
#include "gdt.h"
|
|
#include "idt.h"
|
|
#include "kprintf.h"
|
|
#include "memory.h"
|
|
#include "multiboot.h"
|
|
#include "power.h"
|
|
#include "shell.h"
|
|
#include "string.h"
|
|
#include "terminal.h"
|
|
#include "vbe.h"
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
/* Check if the compiler thinks you are targeting the wrong operating system. */
|
|
#if defined(__linux__)
|
|
#error \
|
|
"You are not using a cross-compiler, you will most certainly run into trouble"
|
|
#endif
|
|
|
|
/* This tutorial will only work for the 32-bit ix86 targets. */
|
|
#if !defined(__i386__)
|
|
#error "This tutorial needs to be compiled with a ix86-elf compiler"
|
|
#endif
|
|
|
|
static void put_pixel(uint32_t color, uint32_t x, uint32_t y)
|
|
{
|
|
const uint32_t coords = x + y * display.pitch;
|
|
display.buff[coords] = color;
|
|
}
|
|
|
|
void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
|
{
|
|
/* terminal_initialize(); */
|
|
init_gdt();
|
|
init_idt();
|
|
init_memory(mbd, magic);
|
|
load_drivers();
|
|
/* kprintf(KERN_ALERT */
|
|
/* "I see no way to confuse an array of 256 seg:off pairs with a
|
|
* " */
|
|
/* "complex 8*unknown quantity -byte descriptor table. -- Troy "
|
|
*/
|
|
/* "Martin 03:50, 22 March 2009 (UTC)\n"); */
|
|
uint32_t color = 0 << 16 | 128 << 8 | 128;
|
|
for (size_t i = 0; i < 100; i++) {
|
|
put_pixel(color, 10, i);
|
|
put_pixel(color, 11, i);
|
|
put_pixel(color, 12, i);
|
|
put_pixel(color, 13, i);
|
|
put_pixel(color, 14, i);
|
|
}
|
|
/* memset(display.buff, 255, 1024 * 1024); */
|
|
/* shell_init(); */
|
|
}
|