From fe12e3bca9d39b31f63bc2d3cd148d2f9221d8c1 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 15:23:01 +0100 Subject: [PATCH] Debug stuff --- Makefile.in | 2 +- kaleid/include/kernel/term.h | 3 +++ kaleid/kernel/init/init.c | 8 +++----- kaleid/kernel/init/table.c | 4 +++- kaleid/kernel/io/term.c | 4 +--- kaleid/kernel/io/vga.c | 4 ++-- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Makefile.in b/Makefile.in index 84325f7..194b4ce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,7 +35,7 @@ CINCLUDES=-Ikaleid/include CFLAGS1=-nostdlib -ffreestanding -mcmodel=large // -std=gnu11 CFLAGS2=_ASMTYPE -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -CFLAGS=$(CFLAGS1) $(CFLAGS2) +CFLAGS=$(CFLAGS1) $(CFLAGS2) -DNDEBUG CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES) diff --git a/kaleid/include/kernel/term.h b/kaleid/include/kernel/term.h index 83d2bb2..29477ee 100644 --- a/kaleid/include/kernel/term.h +++ b/kaleid/include/kernel/term.h @@ -96,6 +96,9 @@ extern Terminal_t *stdOut; #define GetStdOut() (stdOut) #define SetStdOut(x) (stdOut = (x)) +// Debug purposes +volatile ushort *vga; + //------------------------------------------// #ifndef _NO_DEBUG diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index af6cfa7..3caa32d 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -39,14 +39,12 @@ noreturn void StartKern(void *mbInfo, int mbMagic) // We're not ready to deal with interrupts DisableIRQs(); - volatile ushort *vga = (volatile ushort *)0xB8000; - // Kernel terminals - //InitTerms(); + InitTerms(); - *vga++ = ('A' << 8 | 0x0F); + *vga = 'A' | (0x0F << 8); // We're out - StartPanic("Goodbye World :("); + // StartPanic("Goodbye World :("); } diff --git a/kaleid/kernel/init/table.c b/kaleid/kernel/init/table.c index 273105a..5fcdd2c 100644 --- a/kaleid/kernel/init/table.c +++ b/kaleid/kernel/init/table.c @@ -27,5 +27,7 @@ int cpuCount = 1; Processor_t cpuTable[NCPUS] = {0}; -Terminal_t *stdOut, *stdDbg; +Terminal_t *stdOut = 0, *stdDbg = 0; + +volatile ushort *vga = (volatile ushort *)0xB8000; diff --git a/kaleid/kernel/io/term.c b/kaleid/kernel/io/term.c index 1d8adcc..fa5da06 100644 --- a/kaleid/kernel/io/term.c +++ b/kaleid/kernel/io/term.c @@ -32,12 +32,10 @@ extern Terminal_t VGA_Terminal; // void InitTerms(void) { - KalAssert(!GetStdOut() && !GetStdDbg()); + //KalAssert(!GetStdOut() && !GetStdDbg()); VGA_Init(); - // vgaTerm.initDone = INITOK; - SetStdDbg(&VGA_Terminal); SetStdOut(&VGA_Terminal); diff --git a/kaleid/kernel/io/vga.c b/kaleid/kernel/io/vga.c index 54bc63d..dea935b 100644 --- a/kaleid/kernel/io/vga.c +++ b/kaleid/kernel/io/vga.c @@ -37,12 +37,12 @@ #define VGA_ComputeEntry(ch, cl) (((ushort)(ch)) | (ushort)(cl) << 8) // -// Fill terminal with '\0' +// Clear terminal // error_t VGA_ClearTermUnlocked(Terminal_t *term) { const uchar color = VGA_ComputeColorCode(term->fgColor, term->bgColor); - const ushort filler = VGA_ComputeEntry('\0', color); + const ushort filler = VGA_ComputeEntry(' ', color); const size_t bufsize = term->width * term->height; // Fill the buffer