The printk(), panic() and kernel.h update

This commit is contained in:
2026-03-26 21:07:29 +01:00
parent 2f05396651
commit 63a238d2c4
18 changed files with 366 additions and 153 deletions
+41
View File
@@ -0,0 +1,41 @@
#include <bootloader.h>
#include <kernel.h>
#include <paging.h>
#include <serial.h>
#include <splash.h>
#include <system.h>
#include <gdt.h>
#include <isr.h>
#include <pmm.h>
__noreturn
void _start(void) {
// Serial console for debugging
if (serial_init(COM1) < 0) panic("Failed to initialize Serial driver.");
// Load structures from bootloader
if (boot_init() < 0) panic("Failed to parse bootloader structures.");
// The most important function in the world.
splash();
// CPUID thingy :p
uint32_t eax = 0;
char s[12];
cpuid(&eax, (void*)&s[0], (void*)&s[8], (void*)&s[4]);
pr_info("[kernel] CPUID_GETVENDORID: %s\n", s);
// System init
if (gdt_init() < 0) panic("Failed to initalize GDT.");
if (isr_init() < 0) panic("Failed to initalize ISRs.");
// Memory management
if (pmm_init() < 0) panic("Failed to initalize Physical Memory Manager.");
if (pag_init() < 0) panic("Failed to initalize Paging.");
panic("Yeah..");
// Patiently wait for things to do :)
while (1);
}