mirror of
https://github.com/tailix/libkernaux.git
synced 2025-03-03 16:04:29 -05:00
40 lines
940 B
C
40 lines
940 B
C
#include <stdarg.h>
|
|
#include <stdint.h>
|
|
|
|
#include <kernaux/asm/i386.h>
|
|
#include <kernaux/drivers/console.h>
|
|
#include <kernaux/multiboot2.h>
|
|
|
|
void halt();
|
|
|
|
static void panic(const char *str);
|
|
|
|
void main(
|
|
const uint32_t multiboot2_magic,
|
|
const struct KernAux_Multiboot2 *const multiboot2_info
|
|
) {
|
|
if (multiboot2_magic != KERNAUX_MULTIBOOT2_MAGIC) {
|
|
panic("Multiboot 2 magic number is invalid");
|
|
} else {
|
|
kernaux_console_printf("Multiboot 2 magic number is valid\n");
|
|
}
|
|
|
|
if (!KernAux_Multiboot2_is_valid(multiboot2_info)) {
|
|
panic("Multiboot 2 info is invalid");
|
|
} else {
|
|
kernaux_console_printf("Multiboot 2 info is valid\n");
|
|
}
|
|
|
|
KernAux_Multiboot2_print(multiboot2_info, kernaux_console_printf);
|
|
}
|
|
|
|
void halt()
|
|
{
|
|
panic("Kernel main function returned");
|
|
}
|
|
|
|
void panic(const char *const str)
|
|
{
|
|
kernaux_console_printf("panic: %s\n", str);
|
|
kernaux_asm_i386_hang();
|
|
}
|