From 1beaf2b46d1a2e41c22aba249662cbb3b6857326 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 14:47:11 +0100 Subject: [PATCH] Step 0 : InitTerms() is the bug --- Makefile.in | 9 --------- boot/loader/io/terminal.inc | 13 ++++++++++++- boot/loader/loader.asm | 22 +++++++++++++--------- kaleid/kernel/init/init.c | 10 ++++++---- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4e4c536..84325f7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -48,16 +48,7 @@ KERNDIR=kaleid/kernel SYSTDIR=kaleid/system LINXDIR=kaleid/test -//----------------------------------------------------------------------------# -// TESTING MAKEFILE -pseudo_kern: - $(ASM) $(BOOTFLAGS) $(BOOTDIR)/pseudo_kernel.s -o $(OBJDIR)/boot/pkernel.bin - -testing: bootloader pseudo_kern - cat $(BINDIR)/bootloader.bin $(OBJDIR)/boot/pkernel.bin > $(BINDIR)/boot.bin - -//----------------------------------------------------------------------------# // COMMON MAKEFILE COBJDIR=$(OBJDIR)/$(COMMDIR) diff --git a/boot/loader/io/terminal.inc b/boot/loader/io/terminal.inc index 1037c10..2df0252 100644 --- a/boot/loader/io/terminal.inc +++ b/boot/loader/io/terminal.inc @@ -22,7 +22,7 @@ ; You should have received a copy of the GNU General Public License ; ; along with OS/K. If not, see . ; ;=----------------------------------------------------------------------------=; - +global testf ;;VIDEO %define TRAM 0xB8000 ; [T]ext[RAM] @@ -41,6 +41,17 @@ VGA_X dq 0 [BITS 64] +testf: + push rsi + push rbx + mov esi, teststr + mov bl, 0xF + call write + pop rsi + pop rbx + ret +teststr: db "Salut",0 + ;-----------------------------------------------------------------------; ; x64/LM Clear Text Screen Function ; diff --git a/boot/loader/loader.asm b/boot/loader/loader.asm index 0ddf7b6..13278b3 100644 --- a/boot/loader/loader.asm +++ b/boot/loader/loader.asm @@ -62,16 +62,16 @@ MB_start: ; Prints 'ERR:XX' where 'XX' is the str in AX ; ; ---------------------------------------------------------------------------- ; Error: - mov word [CODE], ax + mov word [.code], ax push esi mov bl, 0x0c - mov esi, ERGO + mov esi, .ergo call write32 pop esi jmp Die -ERGO : db "A", 219, 219, " Error " -CODE : db "00" - db 0x0 +.ergo : db 219, 219, 219, " Error " +.code : db "00" + db 0x0 ; ---------------------------------------------------------------------------- ; ; Kills the mind of your computer to get it prostrated ; ; ---------------------------------------------------------------------------- ; @@ -101,11 +101,11 @@ lbegin: call clear ; Clear the screen ;; BEGIN OF CHECKLIST - call MB_check ; Check Multiboot State + call MB_check ; Check Multiboot State, ERR 01 - call Check_cpuid ; Check if cpuid supported - call Is64Bits ; Check if long mode available - call CheckA20 ; Check if A20 is correctly enable + call Check_cpuid ; Check if cpuid supported, ERR 02 + call Is64Bits ; Check if long mode available, ERR 03 + call CheckA20 ; Check if A20 is correctly enable, ERR 04 ;; BEGIN OF WORK call Setup_paging ; Enable paging @@ -126,6 +126,7 @@ lbegin: x64_K db "Now in x64 long mode", 0x0A, 0x0D, 0x0 GoKernel db "Launching Kernel...", 0 +nokernel db "ERROR 05 : Kernel launching error",0 _loader64: ;; Some cleanup @@ -155,4 +156,7 @@ _loader64: jmp StartKern ;; We must never reach this point ------------------------------------------- ;; + mov bl, 0x0c + mov esi, nokernel ; Error 05 + call write jmp Die diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index bda40a5..af6cfa7 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -25,10 +25,12 @@ #include #include + +extern void testf(void); + // // Entry point of the Kaleid kernel // - noreturn void StartKern(void *mbInfo, int mbMagic) { (void)mbInfo; @@ -39,12 +41,12 @@ noreturn void StartKern(void *mbInfo, int mbMagic) volatile ushort *vga = (volatile ushort *)0xB8000; - *vga++ = 'AA'; - // Kernel terminals //InitTerms(); + *vga++ = ('A' << 8 | 0x0F); + // We're out - //StartPanic("Goodbye World :("); + StartPanic("Goodbye World :("); }