Kernel panic uses kprint with parameters

This commit is contained in:
Bananymous 2022-11-16 19:47:19 +02:00
parent 123382eace
commit 550ecbc951
3 changed files with 12 additions and 18 deletions

View File

@ -13,7 +13,7 @@ EXEC_PREFIX?=$(PREFIX)
BOOTDIR?=$(EXEC_PREFIX)/boot
INCLUDEDIR?=$(PREFIX)/include
CFLAGS:=$(CFLAGS) -fstack-protector -ffreestanding -Wall -Wextra
CFLAGS:=$(CFLAGS) -fstack-protector -ffreestanding -Wall -Wextra -Wno-unused-function
CPPFLAGS:=$(CPPFLAGS) -D__is_kernel -Iinclude
LDFLAGS:=$(LDFLAGS)
LIBS:=$(LIBS) -nostdlib -lk -lgcc
@ -30,7 +30,6 @@ LIBS:=$(LIBS) $(KERNEL_ARCH_LIBS)
KERNEL_OBJS=\
$(KERNEL_ARCH_OBJS) \
kernel/kernel.o \
kernel/panic.o \
kernel/SSP.o \
OBJS=\

View File

@ -1,9 +1,19 @@
#pragma once
#include <kernel/kprint.h>
namespace Kernel
{
template<typename... Args>
__attribute__((__noreturn__))
void panic(const char* message);
static void panic(const char* message, Args... args)
{
kprint("Kernel panic: ");
kprint(message, args...);
kprint("\n");
asm volatile("hlt");
__builtin_unreachable();
}
}

View File

@ -1,15 +0,0 @@
#include <kernel/panic.h>
#include <kernel/kprint.h>
namespace Kernel
{
__attribute__((__noreturn__))
void panic(const char* message)
{
kprint("Kernel panic: {}", message);
asm volatile("hlt");
__builtin_unreachable();
}
}