From 882aaa3844a77628d709363f0103086348ac5735 Mon Sep 17 00:00:00 2001 From: Julian Barathieu Date: Mon, 11 Mar 2019 14:07:16 +0100 Subject: [PATCH 1/9] Stuff I don't remember --- Makefile | 25 +++++++++++++++++++++---- Makefile.in | 2 +- kaleid/crtlib/sprintf.c | 1 + kaleid/kernel/init/init.c | 9 ++++++++- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0dc4347..cb4500f 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,24 @@ OBJDIR=build/obj BINDIR=build/bin # Object to link (temp) -l_objects=./build/obj/kaleid/crtlib/memory.o ./build/obj/kaleid/crtlib/rand.o ./build/obj/kaleid/crtlib/string.o ./build/obj/kaleid/crtlib/ultoa.o ./build/obj/kaleid/crtlib/strtol.o ./build/obj/kaleid/crtlib/utoa.o ./build/obj/kaleid/crtlib/status.o ./build/obj/kaleid/crtlib/atoul.o ./build/obj/kaleid/crtlib/atol.o ./build/obj/kaleid/crtlib/itoa.o ./build/obj/kaleid/crtlib/ltoa.o ./build/obj/kaleid/crtlib/atou.o ./build/obj/kaleid/crtlib/arith.o ./build/obj/kaleid/crtlib/atoi.o ./build/obj/kaleid/extras/prog.o ./build/obj/kaleid/extras/argv.o ./build/obj/kaleid/kernel/init/table.o ./build/obj/kaleid/kernel/init/init.o ./build/obj/kaleid/kernel/io/vga.o ./build/obj/kaleid/kernel/io/cursor.o ./build/obj/kaleid/kernel/io/term.o ./build/obj/kaleid/kernel/ke/panic.o ./build/obj/boot/loader.o +l_objects=./build/obj/kaleid/crtlib/memory.o \ + ./build/obj/kaleid/crtlib/rand.o \ + ./build/obj/kaleid/crtlib/string.o \ + ./build/obj/kaleid/crtlib/ultoa.o \ + ./build/obj/kaleid/crtlib/utoa.o \ + ./build/obj/kaleid/crtlib/ctype.o \ + ./build/obj/kaleid/crtlib/itoa.o \ + ./build/obj/kaleid/crtlib/ltoa.o \ + ./build/obj/kaleid/crtlib/sprintf.o \ + ./build/obj/kaleid/extras/prog.o \ + ./build/obj/kaleid/extras/argv.o \ + ./build/obj/kaleid/kernel/init/table.o \ + ./build/obj/kaleid/kernel/init/init.o \ + ./build/obj/kaleid/kernel/io/vga.o \ + ./build/obj/kaleid/kernel/io/cursor.o \ + ./build/obj/kaleid/kernel/io/term.o \ + ./build/obj/kaleid/kernel/ke/panic.o \ + ./build/obj/boot/loader.o #Color codes CL='\033[0;32m' @@ -92,18 +109,18 @@ make_disk: @echo ${CL2}[make_disk]${CL} OK${CL3} test: kernel loader - @qemu-system-x86_64 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -enable-kvm 2> qemu.log & + qemu-system-x86_64 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -enable-kvm 2> qemu.log & @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > loader_disasm32.asm test32: kernel loader - @qemu-system-i386 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -enable-kvm 2> qemu.log & + qemu-system-i386 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -enable-kvm 2> qemu.log & @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > loader_disasm32.asm debug: kernel loader - @qemu-system-x86_64 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -s -S -enable-kvm 2> qemu.log & + qemu-system-x86_64 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -s -S -enable-kvm 2> qemu.log & @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > loader_disasm32.asm diff --git a/Makefile.in b/Makefile.in index 8e4c573..4e4c536 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,7 +27,7 @@ // The madman's Makefile #include "build/preproc.h" -CCNAME="/opt/cross-cc/bin/x86_64-elf-gcc" +CCNAME=x86_64-elf-gcc CC2NAME=gcc COPTIM=-O2 CWARNS=-Wall -Wextra // -Werror=implicit-function-declaration diff --git a/kaleid/crtlib/sprintf.c b/kaleid/crtlib/sprintf.c index 5613434..8174ddd 100644 --- a/kaleid/crtlib/sprintf.c +++ b/kaleid/crtlib/sprintf.c @@ -230,6 +230,7 @@ size_t vsnprintf(char *str, size_t n, const char *fmt, va_list ap) // Unknown/unsupported modifier :| *str++ = mod; + ret++; break; } diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index c50108a..961e55d 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -28,11 +28,18 @@ // // Entry point of the Kaleid kernel // -noreturn void StartKern(void* multibooot_info, int multiboot_magic) +noreturn void StartKern(void *mbInfo, int mbMagic) { + (void)mbInfo; + (void)mbMagic; + // We're not ready to deal with interrupts DisableIRQs(); + volatile ushort *vga = (volatile ushort *)0xB8000; + + *vga++ = 'AA'; + // Kernel terminals InitTerms(); From 1e2bf99bd46d9bdc35c9e0d774e2456847eca78c Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 14:16:56 +0100 Subject: [PATCH 2/9] merge --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 37b89cd..64e4a70 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,6 @@ test: kaleid @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > loader_disasm32.asm -<<<<<<< HEAD test32: kernel loader qemu-system-i386 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -enable-kvm 2> qemu.log & @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm From c39f733e6d0cd97167bb3028990d812315fdd531 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 14:17:02 +0100 Subject: [PATCH 3/9] merge --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 64e4a70..c4f5406 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ test32: kernel loader debug: kernel loader qemu-system-x86_64 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -s -S -enable-kvm 2> qemu.log & -======= + test32: kaleid @qemu-system-i386 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -enable-kvm 2> qemu.log & @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm @@ -132,7 +132,6 @@ test32: kaleid debug: kaleid @qemu-system-x86_64 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -s -S -enable-kvm 2> qemu.log & ->>>>>>> master @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > loader_disasm32.asm From 1beaf2b46d1a2e41c22aba249662cbb3b6857326 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 14:47:11 +0100 Subject: [PATCH 4/9] 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 :("); } From fe12e3bca9d39b31f63bc2d3cd148d2f9221d8c1 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 15:23:01 +0100 Subject: [PATCH 5/9] 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 From 2aeaefe7acf17c7ae9b0e95647b7ccd743069f3f Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 18:10:54 +0100 Subject: [PATCH 6/9] Step 1 : StartPanic is the real problem --- boot/loader/loader.asm | 6 ++++-- kaleid/kernel/init/init.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/boot/loader/loader.asm b/boot/loader/loader.asm index 13278b3..33236e0 100644 --- a/boot/loader/loader.asm +++ b/boot/loader/loader.asm @@ -126,7 +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 +nokernel db 219, 219, 219, " Error 05 : Kernel returns",0 _loader64: ;; Some cleanup @@ -153,9 +153,11 @@ _loader64: call tritemporize ; Let time to see extern StartKern - jmp StartKern + call StartKern ;; We must never reach this point ------------------------------------------- ;; + call tritemporize ; Let time to see + call clear mov bl, 0x0c mov esi, nokernel ; Error 05 call write diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 3caa32d..ce72856 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -42,9 +42,11 @@ noreturn void StartKern(void *mbInfo, int mbMagic) // Kernel terminals InitTerms(); - *vga = 'A' | (0x0F << 8); + vga = 0xB8000; + + *vga = ('A') | (0x0F << 8); // We're out - // StartPanic("Goodbye World :("); + //StartPanic("Goodbye World :("); } From 021c94489bea8adc4eb2bc0d4801e85a5b4a505e Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 18:17:08 +0100 Subject: [PATCH 7/9] Step 1 : StartPanic is the real problem --- boot/loader/cpu/cpu.inc | 4 ++++ kaleid/kernel/init/init.c | 2 -- kaleid/kernel/ke/panic.c | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/boot/loader/cpu/cpu.inc b/boot/loader/cpu/cpu.inc index 8b92819..2bf937a 100644 --- a/boot/loader/cpu/cpu.inc +++ b/boot/loader/cpu/cpu.inc @@ -23,6 +23,10 @@ ; along with OS/K. If not, see . ; ;=----------------------------------------------------------------------------=; +global temporize +global bitemporize +global tritemporize + [BITS 64] temporize: diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index ce72856..39858b5 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -42,8 +42,6 @@ noreturn void StartKern(void *mbInfo, int mbMagic) // Kernel terminals InitTerms(); - vga = 0xB8000; - *vga = ('A') | (0x0F << 8); // We're out diff --git a/kaleid/kernel/ke/panic.c b/kaleid/kernel/ke/panic.c index 3127321..cbb9ac0 100644 --- a/kaleid/kernel/ke/panic.c +++ b/kaleid/kernel/ke/panic.c @@ -62,6 +62,7 @@ noreturn void StartPanic(const char *fmt, ...) if (GetPanicStr()) { GetStdOut()->PrintOnTermUnlocked(GetStdOut(), "\ndouble panic!"); + tritemporize(); HaltCPU(); } @@ -72,6 +73,7 @@ noreturn void StartPanic(const char *fmt, ...) GetStdOut()->PrintOnTermUnlocked(GetStdOut(), "\npanic!\n\n"); GetStdOut()->PrintOnTermUnlocked(GetStdOut(), GetPanicStr()); + tritemporize(); HaltCPU(); } @@ -81,6 +83,7 @@ noreturn void StartPanic(const char *fmt, ...) noreturn void CrashSystem(void) { DisableIRQs(); + tritemporize(); HaltCPU(); } From 348c3b7eadd16623f1e19c4c5842f2943b954973 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 18:17:49 +0100 Subject: [PATCH 8/9] Step 1 : StartPanic is the real problem --- kaleid/kernel/ke/panic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kaleid/kernel/ke/panic.c b/kaleid/kernel/ke/panic.c index cbb9ac0..4e8c7d6 100644 --- a/kaleid/kernel/ke/panic.c +++ b/kaleid/kernel/ke/panic.c @@ -50,6 +50,7 @@ noreturn void StartPanic(const char *fmt, ...) va_list ap; DisableIRQs(); + *vga = ('B') | (0x0F << 8); if (GetCurProc()) _SetCurProc(NULL); if (GetStdOut() == NULL) CrashSystem(); From 4ba948669fdfa622b2931e05a3de18963990d332 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 11 Mar 2019 18:25:35 +0100 Subject: [PATCH 9/9] Step 1 : In StartPanic is the real problem --- Makefile | 9 -------- Makefile.in | 46 ++++++++++++++++++------------------- boot/loader/cpu/cpu.inc | 6 ++--- boot/loader/io/terminal.inc | 2 +- kaleid/kernel/init/init.c | 2 +- kaleid/kernel/ke/panic.c | 2 ++ 6 files changed, 30 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index c4f5406..d7ae0dc 100644 --- a/Makefile +++ b/Makefile @@ -116,15 +116,6 @@ test: kaleid @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > loader_disasm32.asm - -test32: kernel loader - qemu-system-i386 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -enable-kvm 2> qemu.log & - @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm - @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > loader_disasm32.asm - -debug: kernel loader - qemu-system-x86_64 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -s -S -enable-kvm 2> qemu.log & - test32: kaleid @qemu-system-i386 -hda build/bin/disk.img -d cpu_reset,guest_errors,pcall,int -enable-kvm 2> qemu.log & @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > loader_disasm64.asm diff --git a/Makefile.in b/Makefile.in index 194b4ce..eec9b98 100644 --- a/Makefile.in +++ b/Makefile.in @@ -60,25 +60,25 @@ TCC=$(CC2NAME) $(COPTIM) $(CWARNS) $(CINCLUDES) KCC=$(CC) -D_OSK_SOURCE -D_KALEID_KERNEL comm-convert: - COMPILE_CONVRT1(itoa) -D_NEED_ITOA - COMPILE_CONVRT1(ltoa) -D_NEED_LTOA - COMPILE_CONVRT1(utoa) -D_NEED_UTOA - COMPILE_CONVRT1(ultoa) -D_NEED_ULTOA - COMPILE_CONVRT2(atoi) -D_NEED_ATOI - COMPILE_CONVRT2(atol) -D_NEED_ATOL - COMPILE_CONVRT2(atou) -D_NEED_ATOU - COMPILE_CONVRT2(atoul) -D_NEED_ATOUL + @COMPILE_CONVRT1(itoa) -D_NEED_ITOA + @COMPILE_CONVRT1(ltoa) -D_NEED_LTOA + @COMPILE_CONVRT1(utoa) -D_NEED_UTOA + @COMPILE_CONVRT1(ultoa) -D_NEED_ULTOA + @COMPILE_CONVRT2(atoi) -D_NEED_ATOI + @COMPILE_CONVRT2(atol) -D_NEED_ATOL + @COMPILE_CONVRT2(atou) -D_NEED_ATOU + @COMPILE_CONVRT2(atoul) -D_NEED_ATOUL common: comm-convert - COMPILE_COMMON(rand) - COMPILE_COMMON(ctype) - COMPILE_COMMON(string) - COMPILE_COMMON(status) - COMPILE_COMMON(memory) -fno-strict-aliasing - COMPILE_COMMON(strtol) - COMPILE_COMMON(sprintf) - COMPILE_COMMON(../extras/prog) - COMPILE_COMMON(../extras/argv) + @COMPILE_COMMON(rand) + @COMPILE_COMMON(ctype) + @COMPILE_COMMON(string) + @COMPILE_COMMON(status) + @COMPILE_COMMON(memory) -fno-strict-aliasing + @COMPILE_COMMON(strtol) + @COMPILE_COMMON(sprintf) + @COMPILE_COMMON(../extras/prog) + @COMPILE_COMMON(../extras/argv) tests: common $(TCC) -c $(LINXDIR)/test-common.c -o $(LOBJDIR)/test-common.o @@ -92,12 +92,12 @@ KOBJDIR=$(OBJDIR)/$(KERNDIR) KERNOBJS=KOBJ6(init/init, init/table, ke/panic, io/term, io/cursor, io/vga) kernel: common - COMPILE_KERNEL(init/init) - COMPILE_KERNEL(init/table) - COMPILE_KERNEL(ke/panic) - COMPILE_KERNEL(io/cursor) - COMPILE_KERNEL(io/term) - COMPILE_KERNEL(io/vga) + @COMPILE_KERNEL(init/init) + @COMPILE_KERNEL(init/table) + @COMPILE_KERNEL(ke/panic) + @COMPILE_KERNEL(io/cursor) + @COMPILE_KERNEL(io/term) + @COMPILE_KERNEL(io/vga) //LINK_KERNEL(kaleid-kernel.elf) //----------------------------------------------------------------------------# diff --git a/boot/loader/cpu/cpu.inc b/boot/loader/cpu/cpu.inc index 2bf937a..5fa0a5d 100644 --- a/boot/loader/cpu/cpu.inc +++ b/boot/loader/cpu/cpu.inc @@ -23,9 +23,9 @@ ; along with OS/K. If not, see . ; ;=----------------------------------------------------------------------------=; -global temporize -global bitemporize -global tritemporize +[global temporize] +[global bitemporize] +[global tritemporize] [BITS 64] diff --git a/boot/loader/io/terminal.inc b/boot/loader/io/terminal.inc index 2df0252..c2bce9a 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 +[global testf] ;;VIDEO %define TRAM 0xB8000 ; [T]ext[RAM] diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 39858b5..943d3a5 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -45,6 +45,6 @@ noreturn void StartKern(void *mbInfo, int mbMagic) *vga = ('A') | (0x0F << 8); // We're out - //StartPanic("Goodbye World :("); + StartPanic("Goodbye World :("); } diff --git a/kaleid/kernel/ke/panic.c b/kaleid/kernel/ke/panic.c index 4e8c7d6..366dd14 100644 --- a/kaleid/kernel/ke/panic.c +++ b/kaleid/kernel/ke/panic.c @@ -55,6 +55,8 @@ noreturn void StartPanic(const char *fmt, ...) if (GetCurProc()) _SetCurProc(NULL); if (GetStdOut() == NULL) CrashSystem(); + HaltCPU(); + GetStdOut()->ClearTermUnlocked(GetStdOut()); if (fmt == NULL) {