refactor(kernel): clean up KPrint formatting and fix memory reporting

This commit is contained in:
EnderIce2 2025-04-07 05:37:45 +00:00
parent a268f8dc2f
commit a4e5f4785c
Signed by: enderice2
GPG Key ID: FEB6B8A8507BA62E

View File

@ -191,19 +191,14 @@ EXTERNC NIF cold void Main()
KPrint("COM8 is present."); KPrint("COM8 is present.");
KPrint("Display: %dx%d %d bpp R:%d %d G:%d %d B:%d %d", KPrint("Display: %dx%d %d bpp R:%d %d G:%d %d B:%d %d",
Display->GetFramebufferStruct().Width, Display->GetFramebufferStruct().Width, Display->GetFramebufferStruct().Height,
Display->GetFramebufferStruct().Height,
Display->GetFramebufferStruct().BitsPerPixel, Display->GetFramebufferStruct().BitsPerPixel,
Display->GetFramebufferStruct().RedMaskSize, Display->GetFramebufferStruct().RedMaskSize, Display->GetFramebufferStruct().RedMaskShift,
Display->GetFramebufferStruct().RedMaskShift, Display->GetFramebufferStruct().GreenMaskSize, Display->GetFramebufferStruct().GreenMaskShift,
Display->GetFramebufferStruct().GreenMaskSize, Display->GetFramebufferStruct().BlueMaskSize, Display->GetFramebufferStruct().BlueMaskShift);
Display->GetFramebufferStruct().GreenMaskShift,
Display->GetFramebufferStruct().BlueMaskSize,
Display->GetFramebufferStruct().BlueMaskShift);
KPrint("%lld MiB / %lld MiB (%lld MiB reserved)", KPrint("%lld MiB / %lld MiB (%lld MiB reserved)", TO_MiB(KernelAllocator.GetUsedMemory()),
TO_MiB(KernelAllocator.GetUsedMemory()), TO_MiB(KernelAllocator.GetTotalMemory() - KernelAllocator.GetReservedMemory()),
TO_MiB(KernelAllocator.GetTotalMemory()),
TO_MiB(KernelAllocator.GetReservedMemory())); TO_MiB(KernelAllocator.GetReservedMemory()));
#endif #endif
@ -219,8 +214,7 @@ EXTERNC NIF cold void Main()
Interrupts::Initialize(0); Interrupts::Initialize(0);
KPrint("Loading Kernel Symbols"); KPrint("Loading Kernel Symbols");
KernelSymbolTable = KernelSymbolTable = new SymbolResolver::Symbols((uintptr_t)bInfo.Kernel.FileBase);
new SymbolResolver::Symbols((uintptr_t)bInfo.Kernel.FileBase);
if (!KernelSymbolTable->SymTableExists) if (!KernelSymbolTable->SymTableExists)
KernelSymbolTable->AddSymbolInfoFromGRUB(bInfo.Kernel.Symbols.Num, KernelSymbolTable->AddSymbolInfoFromGRUB(bInfo.Kernel.Symbols.Num,