69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <limine.h>
|
|
#include "io/term.h"
|
|
#include "io/printf.h"
|
|
#include "io/serial.h"
|
|
#include "mem/gdt.h"
|
|
#include "mem/utils.h"
|
|
#include "idt/idt.h"
|
|
#include "kernel.h"
|
|
#include "time/timer.h"
|
|
#include "kbd/ps2.h"
|
|
|
|
// Limine version used
|
|
__attribute__((used, section(".limine_requests")))
|
|
static volatile LIMINE_BASE_REVISION(3);
|
|
|
|
// Framebuffer request
|
|
__attribute__((used, section(".limine_requests")))
|
|
static volatile struct limine_framebuffer_request framebuffer_request = {
|
|
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
|
.revision = 0
|
|
};
|
|
|
|
__attribute__((used, section(".limine_requests_start")))
|
|
static volatile LIMINE_REQUESTS_START_MARKER;
|
|
|
|
__attribute__((used, section(".limine_requests_end")))
|
|
static volatile LIMINE_REQUESTS_END_MARKER;
|
|
|
|
struct limine_framebuffer* framebuffer;
|
|
|
|
// Panic
|
|
static void hcf()
|
|
{
|
|
for (;;)
|
|
{
|
|
asm("hlt");
|
|
}
|
|
}
|
|
|
|
// This is our entry point
|
|
void kmain()
|
|
{
|
|
if (!LIMINE_BASE_REVISION_SUPPORTED) hcf();
|
|
if (framebuffer_request.response == NULL || framebuffer_request.response->framebuffer_count < 1) hcf();
|
|
|
|
// Get the first framebuffer from the response
|
|
framebuffer = framebuffer_request.response->framebuffers[0];
|
|
|
|
if (term_init()) hcf();
|
|
|
|
if (serial_init()) kputs("kernel: serial: error: Cannot init serial communication!");
|
|
|
|
CLEAR_INTERRUPTS;
|
|
gdt_init();
|
|
idt_init();
|
|
timer_init();
|
|
SET_INTERRUPTS;
|
|
|
|
keyboard_init(FR);
|
|
|
|
// Draw something
|
|
printf("%s, %s!", "Hello", "world");
|
|
|
|
//printf("%d", 4/0);
|
|
hcf();
|
|
}
|