This commit is contained in:
Alex Kotov 2022-01-15 15:51:16 +05:00
parent 577ef4c3ab
commit bcf727aff2
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 10 additions and 5 deletions

View File

@ -28,13 +28,13 @@ static struct KernAux_PFA pfa;
static struct Paging paging;
void main(
const unsigned long multiboot2_magic,
const unsigned long multiboot2_info_magic,
const struct KernAux_Multiboot2_Info *const multiboot2_info
) {
kernaux_assert_cb = kernaux_assert_fn;
if (multiboot2_magic != KERNAUX_MULTIBOOT2_MAGIC) {
panic("Multiboot 2 magic number is invalid.");
if (multiboot2_info_magic != KERNAUX_MULTIBOOT2_INFO_MAGIC) {
panic("Multiboot 2 info magic number is invalid.");
}
KernAux_Multiboot2_Info_print(multiboot2_info, kernaux_console_printf);

View File

@ -3,10 +3,15 @@
#include <kernaux/asm/i386.h>
#include <kernaux/console.h>
static void poweroff()
{
kernaux_asm_i386_outportw(0x604, 0x2000);
}
void panic(const char *const s)
{
kernaux_console_printf("[FAIL] panic: %s\n", s);
kernaux_asm_i386_hang();
poweroff();
}
void halt()
@ -21,5 +26,5 @@ void kernaux_assert_fn(
) {
kernaux_console_printf("[FAIL] assertion failed: %s:%u: \"%s\"\n",
file, line, str);
kernaux_asm_i386_hang();
poweroff();
}