From 4af19d010f4f2a103d75ceac83f155392032400c Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Sun, 5 Nov 2023 08:48:41 -0800 Subject: [PATCH] [Zion] Add an early debug method without allocations. --- zion/debug/debug.cpp | 2 ++ zion/debug/debug.h | 4 ++++ zion/zion.cpp | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/zion/debug/debug.cpp b/zion/debug/debug.cpp index 44188fa..44347e8 100644 --- a/zion/debug/debug.cpp +++ b/zion/debug/debug.cpp @@ -132,6 +132,8 @@ void dbg_internal(const char* fmt, va_list args) { } // namespace +void early_dbgln(const char* str) { dbgcstr(str); } + void dbg(const char* fmt, ...) { va_list arg; va_start(arg, fmt); diff --git a/zion/debug/debug.h b/zion/debug/debug.h index b343446..5e862f4 100644 --- a/zion/debug/debug.h +++ b/zion/debug/debug.h @@ -4,6 +4,10 @@ #include "include/ztypes.h" +// Debug line without formatting for +// before allocations are available. +void early_dbgln(const char* str); + void dbg(const char* fmt, ...); void dbgln(const char* str, ...); void panic(const char* str, ...); diff --git a/zion/zion.cpp b/zion/zion.cpp index fc44e51..876c221 100644 --- a/zion/zion.cpp +++ b/zion/zion.cpp @@ -17,11 +17,11 @@ #include "syscall/syscall.h" extern "C" void zion() { - dbgln("[boot] Init GDT & IDT."); + early_dbgln("[boot] Init GDT & IDT."); InitGdt(); InitIdt(); - dbgln("[boot] Init Physical Memory Manager."); + early_dbgln("[boot] Init Physical Memory Manager."); phys_mem::InitBootstrapPageAllocation(); KernelHeap heap(0xFFFFFFFF'40000000, 0xFFFFFFFF'80000000); phys_mem::InitPhysicalMemoryManager();