2024-06-27 18:36:32 -04:00
|
|
|
#include <kernel/kernel.h>
|
2024-06-25 22:47:21 -04:00
|
|
|
#include <kernel/multiboot.h>
|
2024-06-27 18:36:32 -04:00
|
|
|
#include <kernel/serial.h>
|
|
|
|
|
|
|
|
kernel_ctx_t ctx = {0};
|
2024-06-25 22:47:21 -04:00
|
|
|
|
|
|
|
void kernel(multiboot_info_t *info) {
|
2024-06-30 21:27:33 -04:00
|
|
|
if (!CHECK_FLAG(info->flags, 6)) goto halt; // Memory map
|
|
|
|
if (!CHECK_FLAG(info->flags, 12)) goto halt; // VBE data
|
2024-06-27 18:36:32 -04:00
|
|
|
ctx.mem_map = (multiboot_memory_map_t *)info->memmapaddress;
|
|
|
|
ctx.mem_map_len = info->memmaplength;
|
|
|
|
|
2024-06-30 21:27:33 -04:00
|
|
|
if (serial_port_init(COM1)) ctx.log_method = LOG_COM1;
|
2024-06-25 22:47:21 -04:00
|
|
|
|
2024-06-27 18:36:32 -04:00
|
|
|
LOG("Kernel log being sent to COM1\n");
|
|
|
|
halt:
|
2024-06-25 15:28:44 -04:00
|
|
|
asm volatile ("cli" ::);
|
|
|
|
for (;;) {}
|
|
|
|
}
|