forked from Bananymous/banan-os
Kernel panic uses kprint with parameters
This commit is contained in:
parent
123382eace
commit
550ecbc951
|
@ -13,7 +13,7 @@ EXEC_PREFIX?=$(PREFIX)
|
||||||
BOOTDIR?=$(EXEC_PREFIX)/boot
|
BOOTDIR?=$(EXEC_PREFIX)/boot
|
||||||
INCLUDEDIR?=$(PREFIX)/include
|
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
|
CPPFLAGS:=$(CPPFLAGS) -D__is_kernel -Iinclude
|
||||||
LDFLAGS:=$(LDFLAGS)
|
LDFLAGS:=$(LDFLAGS)
|
||||||
LIBS:=$(LIBS) -nostdlib -lk -lgcc
|
LIBS:=$(LIBS) -nostdlib -lk -lgcc
|
||||||
|
@ -30,7 +30,6 @@ LIBS:=$(LIBS) $(KERNEL_ARCH_LIBS)
|
||||||
KERNEL_OBJS=\
|
KERNEL_OBJS=\
|
||||||
$(KERNEL_ARCH_OBJS) \
|
$(KERNEL_ARCH_OBJS) \
|
||||||
kernel/kernel.o \
|
kernel/kernel.o \
|
||||||
kernel/panic.o \
|
|
||||||
kernel/SSP.o \
|
kernel/SSP.o \
|
||||||
|
|
||||||
OBJS=\
|
OBJS=\
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <kernel/kprint.h>
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel
|
||||||
{
|
{
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
__attribute__((__noreturn__))
|
__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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue