summaryrefslogtreecommitdiff
path: root/kernel/core/kernel.cpp
diff options
context:
space:
mode:
authorArseney300 <Arseney300@gmail.com>2026-04-12 02:01:25 +0700
committerArseney300 <Arseney300@gmail.com>2026-04-12 02:01:25 +0700
commit2496ffd6d97c3ccd3e325687442d31ab035479a1 (patch)
tree5d176669f823182fe74261f076dc11c8e8f88025 /kernel/core/kernel.cpp
parent496246c92dabe6757480147016490ea6ae43bb66 (diff)
bastion: add freestanding C++ standard library (libcxx)feature/freestanding-libcxx
Header-only implementation of a C++ standard library subset for the freestanding kernel, using Clang builtins wherever possible. Provides 19 public headers (~35 internal files): type_traits, utility, memory, algorithm, functional, concepts, array, string_view, span, optional, expected, variant, tuple, bit, limits, new, initializer_list, cstdint, cstddef, and source_location. Integration changes: - kernel/Makefile: add -Ilib/libcxx/include to include path - kernel/lib/string.cpp: add memchr and strncmp (needed by string_view) - kernel/lib/cxxabi.cpp: guard placement new against <new> header conflict - kernel/include/kernel/kernel.h: Panic() now uses std::source_location - kernel/core/kernel.cpp: Panic() implementation updated to match Builds cleanly on both x86_64 and aarch64 with zero new warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'kernel/core/kernel.cpp')
-rw-r--r--kernel/core/kernel.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/core/kernel.cpp b/kernel/core/kernel.cpp
index c2d1806..e381972 100644
--- a/kernel/core/kernel.cpp
+++ b/kernel/core/kernel.cpp
@@ -262,20 +262,20 @@ const PanicInfo& Kernel::GetPanicInfo() const {
return panic_info;
}
-[[noreturn]] void Kernel::Panic(const char* msg, const char* file, const char* func, uint32_t line) {
+[[noreturn]] void Kernel::Panic(const char* msg, std::source_location loc) {
state = KernelState::Panicked;
panic_info.message = msg;
- panic_info.file = file;
- panic_info.line = line;
- panic_info.func = func;
+ panic_info.file = loc.file_name();
+ panic_info.line = loc.line();
+ panic_info.func = loc.function_name();
panic_info.cpu_id = 0; // TODO: get actual CPU id when SMP is added
// Print panic banner — kcon may or may not be initialized yet
kcon::putchar('\n');
kcon::println("!!! KERNEL PANIC !!!");
kcon::kprintf(" %s\n", msg);
- kcon::kprintf(" at %s:%s:%u\n", file, func, line);
+ kcon::kprintf(" at %s:%s:%u\n", loc.file_name(), loc.function_name(), loc.line());
kcon::putchar('\n');
arch::halt();