diff --git a/kaleid/kernel/init/info.c b/kaleid/kernel/init/info.c index 9bf6830..a93f8b8 100644 --- a/kaleid/kernel/init/info.c +++ b/kaleid/kernel/init/info.c @@ -111,7 +111,7 @@ void BtDoSanityChecks(uint mbMagic) { if (!(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC)) KeStartPanic("Magic number %x is incorrect\n", mbMagic); - DebugLog("\t Kernel successfully loaded at %p\n", + DebugLog("Kernel successfully loaded at %p\n", BtLoaderInfo.kernelAddr); } diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 3a4d4c1..4cb3564 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -88,6 +88,10 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg) PsInitSched(); // Command line (kernel mode) + KernLog("Copyright (C) 2018-2020 The OS/K Team\n" + "This program comes with ABSOLUTELY NO WARRANTY.\n" + "This is free software, type `ver' for details.\n"); + ShStartShell(); //KeCrashSystem(); diff --git a/kaleid/kernel/io/acpi.c b/kaleid/kernel/io/acpi.c index 424eda0..43064bc 100644 --- a/kaleid/kernel/io/acpi.c +++ b/kaleid/kernel/io/acpi.c @@ -121,7 +121,7 @@ static inline void IoInitRSDP(void) if (rsdp->legacy.revision == 1 || rsdp->legacy.revision >= 3) KeStartPanic("Invalid ACPI Revision : %d", rsdp->legacy.revision); - KernLog("\tACPI Revision %d (OEM %s)\n", + DebugLog("ACPI Revision %d (OEM %s)\n", (uint)rsdp->legacy.revision, rsdp->legacy.OEMID ); @@ -153,14 +153,14 @@ static inline void IoInitRXSDT(void) KeStartPanic("Invalid RSDT checksum : %d vs 0", checksum); if (IoACPIVersion == 1) { - KernLog("\tACPI Root System Table %s (%s) length %d [%p]\n", + DebugLog("ACPI Root System Table %s (%s) length %d [%p]\n", rxsdt->signature, rxsdt->OEMID, rxsdt->length, rxsdt ); } else { - KernLog("\tACPI Extended System Table %s (%s) length %d [%p]\n", + DebugLog("ACPI Extended System Table %s (%s) length %d [%p]\n", rxsdt->signature, rxsdt->OEMID, rxsdt->length, @@ -187,7 +187,7 @@ static inline void IoSearchAcpiTables(void) entries = (xrsdt->length - sizeof(xrsdt)) / 8; } - KernLog("\tACPI detected %d entries\n", entries); + DebugLog("ACPI detected %d entries\n", entries); curInt = &(xrsdt->sdtTablePtr); curLong = &(xrsdt->sdtTablePtr); @@ -203,7 +203,7 @@ static inline void IoSearchAcpiTables(void) if (MmIsBusyZone(table)) { checksum = DoChecksum(table, (size_t)table->length, 0, 0); if (!checksum) { - KernLog("\tACPI System Table %s (OEM %s) length %d [%p]\n", + DebugLog("ACPI System Table %s (OEM %s) length %d [%p]\n", table->signature, table->OEMID, table->length, @@ -221,12 +221,6 @@ static inline void IoSearchAcpiTables(void) // void IoInitAcpi(void) { - if (BtFirmwareInfo.romValid) - KernLog("\tRom Table is valid at %p\n", BtFirmwareInfo.romTable); - - if (BtFirmwareInfo.apmValid) - KernLog("\tApm Table is valid at %p\n", BtFirmwareInfo.apmTable); - // MAP ACPI PAGES // Search the zone where the start address is diff --git a/kaleid/kernel/io/vga.c b/kaleid/kernel/io/vga.c index ff3c9fe..41d9662 100644 --- a/kaleid/kernel/io/vga.c +++ b/kaleid/kernel/io/vga.c @@ -176,6 +176,9 @@ error_t IoInitVGABuffer(void) static char bvgabufsrc[1 * MB]; static Buffer_t bvgabufstruct; + static char bdbgbufsrc[1 * MB]; + static Buffer_t bdbgbufstruct; + BStdOut = &bvgabufstruct; BOpenTermBufEx(&BStdOut, @@ -186,7 +189,15 @@ error_t IoInitVGABuffer(void) BEnableAutoScroll(BStdOut); - BStdDbg = BStdOut; + BStdDbg = &bdbgbufstruct; + + BOpenTermBufEx(&BStdDbg, + bdbgbufsrc, BS_WRONLY, + BtVideoInfo.framebufferWidth, + BtVideoInfo.framebufferHeight, + 10, NULL); + + BEnableAutoScroll(BStdDbg); return EOK; } diff --git a/kaleid/kernel/ke/cpuid.c b/kaleid/kernel/ke/cpuid.c index 2682ba2..debbfbb 100644 --- a/kaleid/kernel/ke/cpuid.c +++ b/kaleid/kernel/ke/cpuid.c @@ -44,7 +44,7 @@ void KeGetCpuInfos(void) CpuInfo.frequency = KeGetCpuFrequency(); } - DebugLog("\tCPU %s %#d MHz detected with features %#x\n", + DebugLog("CPU %s %#d MHz detected with features %#x\n", CpuInfo.vendorStr, (long)(CpuInfo.frequency / 1000.0), CpuInfo.featureFlag diff --git a/kaleid/kernel/ke/idt.c b/kaleid/kernel/ke/idt.c index ffc029b..4060b88 100644 --- a/kaleid/kernel/ke/idt.c +++ b/kaleid/kernel/ke/idt.c @@ -27,6 +27,7 @@ #include #include #include +#include IdtEntry_t idt[256] = { 0 }; IdtPtr_t _KeIdtPtr; @@ -183,7 +184,7 @@ void KeSetupIDT(void) // Load IDT KeLoadIDT(); //DebugLog("\tInterrupt table initialized at %p\n", _KeIdtPtr.base); - KernLog("\tInterrupts activated\n"); + DebugLog("Interrupts activated\n"); } // @@ -308,8 +309,10 @@ void _KeHandleISR(ISRFrame_t *regs) } } - bprintf(BStdOut, "[ISR 0x%x] %s\n", regs->intNo, "Unknown ISR Exception"); - BStdOut->flusher(BStdOut); + bprintf(BStdDbg, "[%d]\tISR 0x%x %s\n", + KeGetTicks(), + regs->intNo, + "Unknown ISR Exception"); KeSendEOItoPIC(regs->intNo); } diff --git a/kaleid/kernel/ke/log.c b/kaleid/kernel/ke/log.c index 0765e1f..b8d99ba 100644 --- a/kaleid/kernel/ke/log.c +++ b/kaleid/kernel/ke/log.c @@ -24,6 +24,7 @@ #include #include +#include // // Prints formatted string on standard output @@ -49,6 +50,7 @@ void DebugLog(const char *fmt, ...) va_list ap; va_start(ap, fmt); + BPrintOnBuf(BStdDbg, "[%d]\t", KeGetTicks()); BPrintOnBufV(BStdDbg, fmt, ap); va_end(ap); } diff --git a/kaleid/kernel/ke/pit.c b/kaleid/kernel/ke/pit.c index cd76135..f5902fc 100644 --- a/kaleid/kernel/ke/pit.c +++ b/kaleid/kernel/ke/pit.c @@ -132,7 +132,7 @@ void KeEnablePIT(void) // Setting up the IRQ line KeUnmaskIRQ(0); - DebugLog("\tPIT activated with period %d ms\n", 1000/PIT_FREQUENCY); + DebugLog("PIT activated with period %d ms\n", 1000/PIT_FREQUENCY); KeRestoreIRQs(flags); KeEnableNMI(); diff --git a/kaleid/kernel/ke/rtc.c b/kaleid/kernel/ke/rtc.c index e8fcd5b..16bda2b 100644 --- a/kaleid/kernel/ke/rtc.c +++ b/kaleid/kernel/ke/rtc.c @@ -213,7 +213,7 @@ void KeEnableRTC(void) KeEnableNMI(); srand(KeGetTimeStamp()); // Initializes the kernel number generator - DebugLog("\tRTC interrupt frequency set to %d Hz\n", + DebugLog("RTC interrupt frequency set to %d Hz\n", 32768 >> (RTC_RATE - 1)); } diff --git a/kaleid/kernel/mm/gdt.c b/kaleid/kernel/mm/gdt.c index 2ed6c78..61ecced 100644 --- a/kaleid/kernel/mm/gdt.c +++ b/kaleid/kernel/mm/gdt.c @@ -63,10 +63,10 @@ void MmInitGdt(void) tss.ist3 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR STACK tss.iomap_base = sizeof(tss); - /* KernLog("\tISR Stacks initialized : Rescue %p, Normal %p, %p\n", */ - /* tss.ist1, */ - /* tss.ist2, */ - /* tss.ist3); */ + DebugLog("ISR Stacks initialized : Rescue %p, Normal %p, %p\n", + tss.ist1, + tss.ist2, + tss.ist3); memmove(&gdt[2], &tssDesc, sizeof(TssDescriptor_t)); diff --git a/kaleid/kernel/mm/map.c b/kaleid/kernel/mm/map.c index bf2fd4e..201567a 100644 --- a/kaleid/kernel/mm/map.c +++ b/kaleid/kernel/mm/map.c @@ -99,7 +99,7 @@ static error_t InitMemoryMap(void) if (memoryMap.freeRamSize < MINIMUM_RAM_SIZE) return ENOMEM; - KernLog("\tAvailable RAM size : %u MB\n", + DebugLog("Available RAM size : %u MB\n", memoryMap.freeRamSize / MB); return EOK; diff --git a/kaleid/kernel/mm/paging.c b/kaleid/kernel/mm/paging.c index bcbd8b6..0ef38b2 100644 --- a/kaleid/kernel/mm/paging.c +++ b/kaleid/kernel/mm/paging.c @@ -71,7 +71,7 @@ void MmInitPaging(void) ulong lastDirectoryAddr = 0; ulong phDirSize = 0; - KernLog("\tActivating paging...\n"); + DebugLog("Activating paging...\n"); // Maximum PHYSICAL address in memory ulong phRamSize = memoryMap.freeRamSize + memoryMap.nonfreeRamSize; @@ -171,21 +171,21 @@ void MmInitPaging(void) MmPT[index] = (ulong)curAddrPT | PRESENT; MmPhysicalPageTable[xedni] = (ulong)curAddrPT; MmStackGuards[0] = (ulong)curAddrPT; - //DebugLog("\tStack Guard at %p\n", curAddrPT); + DebugLog("Stack Guard at %p\n", curAddrPT); } else if ((ulong)curAddrPT == (ulong)BtLoaderInfo.kernelEndAddr) { MmPT[index] = (ulong)curAddrPT | PRESENT; MmPhysicalPageTable[xedni] = (ulong)curAddrPT; MmStackGuards[1] = (ulong)curAddrPT; - //DebugLog("\tStack Guard at %p\n", curAddrPT); + DebugLog("Stack Guard at %p\n", curAddrPT); } // SECTION .TEXT PROTECTION else if ((ulong)curAddrPT >= (ulong)&_text && (ulong)curAddrPT <= (ulong)&_text_end) { MmPT[index] = (ulong)curAddrPT | PRESENT; MmPhysicalPageTable[xedni] = (ulong)curAddrPT; - //DebugLog("\tSection .text at %p\n", curAddrPT); + DebugLog("Section .text at %p\n", curAddrPT); } // SECTION .DATA PROTECTION else if ((ulong)curAddrPT >= (ulong)&_data @@ -195,14 +195,14 @@ void MmInitPaging(void) | READWRITE | NX; MmPhysicalPageTable[xedni] = (ulong)curAddrPT; - //DebugLog("\tSection .data at %p\n", curAddrPT); + DebugLog("Section .data at %p\n", curAddrPT); } // SECTION .RODATA PROTECTION else if ((ulong)curAddrPT >= (ulong)&_rodata && (ulong)curAddrPT <= (ulong)&_rodata_end) { MmPT[index] = (ulong)curAddrPT | PRESENT | NX; MmPhysicalPageTable[xedni] = (ulong)curAddrPT; - //DebugLog("\tSection .rodata at %p\n", curAddrPT); + DebugLog("Section .rodata at %p\n", curAddrPT); } // While we're inside the kernel pages else if ((ulong)curAddrPT <= MmPhysLastKernAddress) { @@ -219,7 +219,7 @@ void MmInitPaging(void) MmLoadPML4((void *)MmPageMapLevel4); MmEnableWriteProtect(); - DebugLog("\tPage table size : %u MB\n", (lastDirectoryAddr - firstDirectoryAddr + phDirSize)/MB); + DebugLog("Page table size : %u MB\n", (lastDirectoryAddr - firstDirectoryAddr + phDirSize)/MB); } // diff --git a/kaleid/kernel/ps/sched.c b/kaleid/kernel/ps/sched.c index 54a5fb4..89fe03a 100644 --- a/kaleid/kernel/ps/sched.c +++ b/kaleid/kernel/ps/sched.c @@ -307,6 +307,8 @@ void PsInitSched(void) PsUnlockSched(); PsInitialized = true; + + DebugLog("Scheduler initialized\n"); } // diff --git a/kaleid/kernel/sh/shcmds.c b/kaleid/kernel/sh/shcmds.c index d74d7fd..9991a4e 100644 --- a/kaleid/kernel/sh/shcmds.c +++ b/kaleid/kernel/sh/shcmds.c @@ -4,7 +4,7 @@ // Desc: Kernel shell // // // // // -// Copyright © 2018-2019 The OS/K Team // +// Copyright © 2018-2020 The OS/K Team // // // // This file is part of OS/K. // // // @@ -166,7 +166,7 @@ error_t CmdVersion(int argc, char **argv, char *cmdline) CN ); - KernLog("Copyright (C) 2018-2019 The OS/K Team\n\n"); + KernLog("Copyright (C) 2018-2020 The OS/K Team\n\n"); KernLog("This program is free software, released under the\n"); KernLog("terms of the GNU GPL version 3 or later as published\n"); KernLog("by the Free Software Foundation.\n");