From 08b4fa927d5be22100a873c72e86216ba9467ba9 Mon Sep 17 00:00:00 2001 From: Julian Barathieu Date: Tue, 19 Mar 2019 13:37:23 +0100 Subject: [PATCH 01/13] Slighly better terminal stuff --- kaleid/include/base/assert.h | 2 +- kaleid/include/extras/locks.h | 16 +++--- kaleid/include/kernel/panic.h | 4 +- kaleid/include/kernel/term.h | 31 ++++------- kaleid/kernel/init/table.c | 3 +- kaleid/kernel/io/term.c | 102 +++++++++++++++++++++++++++------- kaleid/kernel/io/vga.c | 65 ++-------------------- kaleid/kernel/ke/panic.c | 16 +++--- kaleid/kernel/mm/heap.c | 4 +- kaleid/kernel/mm/malloc.c | 2 +- 10 files changed, 118 insertions(+), 127 deletions(-) diff --git a/kaleid/include/base/assert.h b/kaleid/include/base/assert.h index a6986d2..97fadac 100644 --- a/kaleid/include/base/assert.h +++ b/kaleid/include/base/assert.h @@ -77,7 +77,7 @@ noreturn void __assert_handler(const char *, const char *, int, const char *); // When debugging // //------------------------------------------// -#if !defined(_NO_DEBUG) && !defined(NDEBUG) && !defined(KalAssert) +#if /*!defined(_NO_DEBUG) && !defined(NDEBUG) &&*/ !defined(KalAssert) // // Check whether (x) holds, if not call __assert_handler diff --git a/kaleid/include/extras/locks.h b/kaleid/include/extras/locks.h index d97b0a5..9248094 100644 --- a/kaleid/include/extras/locks.h +++ b/kaleid/include/extras/locks.h @@ -51,7 +51,7 @@ enum LockType_t // Mutex-type lock // // WARNING - // AquireLock() panics when used on a mutex while not running a process + // AcquireLock() panics when used on a mutex while not running a process KLOCK_MUTEX, // Spinlock-type lock @@ -121,18 +121,18 @@ void DestroyLock(Lock_t *lock) } // -// Aquire the lock -// Panic on double aquisition since that should never happen +// Acquire the lock +// Panic on double acquisition since that should never happen // until we have at least a basic scheduler // static inline -void AquireLock(Lock_t *lock) +void AcquireLock(Lock_t *lock) { KalAssert(lock->initDone == INITOK); while (!__sync_bool_compare_and_swap(&lock->locked, 0, 1)) { #ifdef _KALEID_KERNEL - StartPanic("AquireLock on an already locked object"); + StartPanic("AcquireLock on an already locked object"); #else if likely (lock->type == KLOCK_SPINLOCK) continue; #ifdef _OSK_SOURCE @@ -146,8 +146,8 @@ void AquireLock(Lock_t *lock) } // -// Release an already aquired lock -// Panic if the lock was never aquired +// Release an already acquired lock +// Panic if the lock was never acquired // static inline void ReleaseLock(Lock_t *lock) @@ -161,7 +161,7 @@ void ReleaseLock(Lock_t *lock) } // -// Tries to aquire lock +// Tries to acquire lock // static inline bool AttemptLock(Lock_t *lock) diff --git a/kaleid/include/kernel/panic.h b/kaleid/include/kernel/panic.h index 4c7607b..ac80e6e 100644 --- a/kaleid/include/kernel/panic.h +++ b/kaleid/include/kernel/panic.h @@ -31,9 +31,7 @@ //------------------------------------------// -// Can't use the macro because panicStr is an array -static inline char *GetPanicStr(void) -{ return GetCurCPU().panicStr; } +extern volatile char *PanicStr; //------------------------------------------// diff --git a/kaleid/include/kernel/term.h b/kaleid/include/kernel/term.h index fcc000b..e35b129 100644 --- a/kaleid/include/kernel/term.h +++ b/kaleid/include/kernel/term.h @@ -80,46 +80,35 @@ struct Terminal_t TermColor_t bgColor; // Defined in driver - error_t (*ClearTermUnlocked)(Terminal_t *); - error_t (*PutOnTermUnlocked)(Terminal_t *, char); - error_t (*PrintOnTermUnlocked)(Terminal_t *, const char *); + error_t (*clear)(Terminal_t *); + error_t (*putchar)(Terminal_t *, char); }; //------------------------------------------// void InitTerms(void); error_t ClearTerm(Terminal_t *); -error_t PutOnTerm(Terminal_t *, char); -error_t PrintOnTerm(Terminal_t *, const char *); error_t ChTermColor(Terminal_t *, TermColor_t, TermColor_t); +error_t PutOnTerm(Terminal_t *, char); +error_t PutOnTermUnlocked(Terminal_t *, char); + +error_t PrintOnTerm(Terminal_t *, const char *); +error_t PrintOnTermUnlocked(Terminal_t *, const char *); + error_t KernLog(const char *, ...); //------------------------------------------// -extern Terminal_t *stdOut; -#define GetStdOut() (stdOut) -#define SetStdOut(x) (stdOut = (x)) - -// Debug purposes -volatile ushort *vga; +extern Terminal_t *StdOut; +extern Terminal_t *StdDbg; //------------------------------------------// #ifndef _NO_DEBUG - -extern Terminal_t *stdDbg; -#define GetStdDbg() (stdDbg) -#define SetStdDbg(x) (stdDbg = (x)) - error_t DebugLog(const char *, ...); - #else // _NO_DEBUG - -#define GetStdDbg() NULL -#define SetStdDbg(x) ((void)0) #define DebugLog(fmt, ...) EOK - #endif //------------------------------------------// diff --git a/kaleid/kernel/init/table.c b/kaleid/kernel/init/table.c index 7a51088..22317ad 100644 --- a/kaleid/kernel/init/table.c +++ b/kaleid/kernel/init/table.c @@ -27,5 +27,6 @@ int cpuCount = 1; Processor_t cpuTable[NCPUS] = {0}; -Terminal_t *stdOut = 0, *stdDbg = 0; +Terminal_t *StdOut = 0, *StdDbg = 0; +volatile char *PanicStr = 0; diff --git a/kaleid/kernel/io/term.c b/kaleid/kernel/io/term.c index ce34545..e7cd176 100644 --- a/kaleid/kernel/io/term.c +++ b/kaleid/kernel/io/term.c @@ -32,14 +32,14 @@ extern Terminal_t VGA_Terminal; // void InitTerms(void) { - KalAssert(!GetStdOut() && !GetStdDbg()); + KalAssert(!StdOut && !StdDbg); VGA_Init(); - SetStdDbg(&VGA_Terminal); - SetStdOut(&VGA_Terminal); + StdDbg = &VGA_Terminal; + StdOut = &VGA_Terminal; - ClearTerm(GetStdOut()); + ClearTerm(StdOut); } // @@ -52,8 +52,8 @@ error_t ClearTerm(Terminal_t *term) if (term == NULL) return EINVAL; KalAssert(term->initDone == INITOK); - AquireLock(&term->lock); - retcode = term->ClearTermUnlocked(term); + AcquireLock(&term->lock); + retcode = term->clear(term); ReleaseLock(&term->lock); return retcode; @@ -70,7 +70,7 @@ error_t ChTermColor(Terminal_t *term, TermColor_t fgColor, TermColor_t bgColor) if (term == NULL) return EINVAL; - AquireLock(&term->lock); + AcquireLock(&term->lock); term->fgColor = fgColor; term->bgColor = bgColor; @@ -81,39 +81,99 @@ error_t ChTermColor(Terminal_t *term, TermColor_t fgColor, TermColor_t bgColor) } // -// Writes a single character on the terminal +// Writes a single character on the terminal (UNLOCKED version) +// +error_t PutOnTermUnlocked(Terminal_t *term, char ch) +{ + uint i; + size_t prevY; + error_t rc = EOK; + + if (ch == '\r') { + term->currentX = 0; + return EOK; + } + + // Line feed first takes us to the very end of the line + // Later in this function we actually do the line feed + else if (ch == '\n') { + term->currentX = term->width - 1; + } + + // Tabulations account for "term->tabSize" spaces + else if (ch == '\t') { + prevY = term->currentX; + for (i = 0; i < term->tabSize; i++) { + // Make sure tabulations can't spread over two lines + if (term->currentX == prevY) { + rc = term->putchar(term, ' '); + if (rc) return rc; + } + } + } + + else rc = term->putchar(term, ch); + + // Did we reach the end of line? + if (!rc && ++term->currentX == term->width) { + term->currentX = 0; + + // Did we reach the buffer's end? + if (++term->currentY == term->height) { + term->currentY = 0; + } + } + + return rc; +} + + +// +// Writes a single character on the terminal (LOCKED version) // error_t PutOnTerm(Terminal_t *term, char ch) { - error_t retcode; + error_t rc; if (term == NULL) return EINVAL; KalAssert(term->initDone == INITOK); - AquireLock(&term->lock); - retcode = term->PutOnTermUnlocked(term, ch); + AcquireLock(&term->lock); + rc = PutOnTermUnlocked(term, ch); ReleaseLock(&term->lock); - return retcode; + return rc; } // -// Prints string on terminal +// Prints string on terminal (UNLOCKED version) +// +error_t PrintOnTermUnlocked(Terminal_t *term, const char *str) +{ + error_t rc = EOK; + + while (*str && rc == EOK) { + rc = PutOnTermUnlocked(term, *str++); + } + + return rc; +} + +// +// Prints string on terminal (LOCKED version) // error_t PrintOnTerm(Terminal_t *term, const char *str) { - error_t retcode = EOK; + error_t rc = EOK; if (term == NULL) return EINVAL; KalAssert(term->initDone == INITOK); - AquireLock(&term->lock); - while (*str && retcode == EOK) { - retcode = term->PutOnTermUnlocked(term, *str++); - } + AcquireLock(&term->lock); + rc = PrintOnTermUnlocked(term, str); ReleaseLock(&term->lock); - return retcode; + return rc; } // @@ -130,7 +190,7 @@ error_t KernLog(const char *fmt, ...) vsnprintf(logbuf, KLOG_MAX_BUFSIZE, fmt, ap); va_end(ap); - return PrintOnTerm(GetStdOut(), logbuf); + return PrintOnTerm(StdOut, logbuf); } #ifndef _NO_DEBUG @@ -148,7 +208,7 @@ error_t DebugLog(const char *fmt, ...) vsnprintf(logbuf, KLOG_MAX_BUFSIZE, fmt, ap); va_end(ap); - return PrintOnTerm(GetStdDbg(), logbuf); + return PrintOnTerm(StdDbg, logbuf); } #endif diff --git a/kaleid/kernel/io/vga.c b/kaleid/kernel/io/vga.c index de00c35..600eae0 100644 --- a/kaleid/kernel/io/vga.c +++ b/kaleid/kernel/io/vga.c @@ -59,69 +59,15 @@ error_t VGA_ClearTermUnlocked(Terminal_t *term) // error_t VGA_PutOnTermUnlocked(Terminal_t *term, char ch) { - uint i; - size_t prevY; + ushort *buffer = (ushort *)term->data; + const size_t offset = VGA_ComputeOffset(term, term->currentX, term->currentY); + buffer[offset] = VGA_ComputeEntry(ch, VGA_ComputeColorCode(term->fgColor, term->bgColor)); - if (ch == '\r') { - term->currentX = 0; - return EOK; - } - - // Line feed first takes us to the very end of the line - // Later in this function we actually do the line feed - else if (ch == '\n') { - term->currentX = term->width - 1; - } - - // Tabulations account for "term->tabSize" spaces - else if (ch == '\t') { - prevY = term->currentX; - for (i = 0; i < term->tabSize; i++) { - // Make sure tabulations can't spread over two lines - if (term->currentX == prevY) { - VGA_PutOnTermUnlocked(term, ' '); - } - } - } - - else { - ushort *buffer = (ushort *)term->data; - const size_t offset = VGA_ComputeOffset(term, term->currentX, term->currentY); - buffer[offset] = VGA_ComputeEntry(ch, VGA_ComputeColorCode(term->fgColor, term->bgColor)); - } - - // Did we reach the end of line? - if (++term->currentX == term->width) { - term->currentX = 0; - - // Did we reach the buffer's end? - if (++term->currentY == term->height) { - // XXX scroll up - term->currentY = 0; - } - } - - // Nothing can go wrong return EOK; } -// -// Prints string on terminal -// -error_t VGA_PrintOnTermUnlocked(Terminal_t *term, const char *str) -{ - error_t retcode = EOK; - - while (*str && retcode == EOK) { - retcode = term->PutOnTermUnlocked(term, *str++); - } - - return retcode; -} - // // VGA output -// XXX custom sizes // Terminal_t VGA_Terminal = { .initDone = FALSE, @@ -140,9 +86,8 @@ Terminal_t VGA_Terminal = { .fgColor = KTERM_COLOR_LGREY, .bgColor = KTERM_COLOR_BLACK, - .ClearTermUnlocked = VGA_ClearTermUnlocked, - .PutOnTermUnlocked = VGA_PutOnTermUnlocked, - .PrintOnTermUnlocked = VGA_PrintOnTermUnlocked, + .clear = VGA_ClearTermUnlocked, + .putchar = VGA_PutOnTermUnlocked, }; diff --git a/kaleid/kernel/ke/panic.c b/kaleid/kernel/ke/panic.c index def362c..4de0bfe 100644 --- a/kaleid/kernel/ke/panic.c +++ b/kaleid/kernel/ke/panic.c @@ -37,7 +37,7 @@ noreturn void __assert_handler(const char *msg, (void)file; (void)line; (void)func; - StartPanic("cpu%d: In function '%s', from %s line %d - assert() failed: '%s'", + StartPanic("cpu%d: In function '%s', from %s line %d - assertion failed: '%s'", _GetCurCPU(), func, file, line, msg); } @@ -52,25 +52,23 @@ noreturn void StartPanic(const char *fmt, ...) DisableIRQs(); if (GetCurProc()) _SetCurProc(NULL); - if (GetStdOut() == NULL) CrashSystem(); - - GetStdOut()->ClearTermUnlocked(GetStdOut()); + if (StdOut == NULL) CrashSystem(); if (fmt == NULL) { fmt = "(no message given)"; } - if (*GetPanicStr()) { - GetStdOut()->PrintOnTermUnlocked(GetStdOut(), "\nDouble panic!"); + if (PanicStr[0] != 0) { + PrintOnTermUnlocked(StdOut, "\nDouble panic!"); HaltCPU(); } va_start(ap, fmt); - vsnprintf(GetPanicStr(), PANICSTR_SIZE, fmt, ap); + vsnprintf(PanicStr, PANICSTR_SIZE, fmt, ap); va_end(ap); - GetStdOut()->PrintOnTermUnlocked(GetStdOut(), "\nPanic!\n\n"); - GetStdOut()->PrintOnTermUnlocked(GetStdOut(), GetPanicStr()); + PrintOnTermUnlocked(StdOut, "\nPanic!\n\n"); + PrintOnTermUnlocked(StdOut, PanicStr); HaltCPU(); } diff --git a/kaleid/kernel/mm/heap.c b/kaleid/kernel/mm/heap.c index dd3d18c..06dbf9c 100644 --- a/kaleid/kernel/mm/heap.c +++ b/kaleid/kernel/mm/heap.c @@ -47,11 +47,11 @@ void InitHeap(void) } // -// Aquires control of the heap's lock +// Acquires control of the heap's lock // void LockHeap(void) { - AquireLock(&_heap_lock); + AcquireLock(&_heap_lock); } // diff --git a/kaleid/kernel/mm/malloc.c b/kaleid/kernel/mm/malloc.c index e46e94c..cc7389c 100644 --- a/kaleid/kernel/mm/malloc.c +++ b/kaleid/kernel/mm/malloc.c @@ -46,7 +46,7 @@ error_t KalAllocMemory(void **ptr, size_t req, int flags, size_t align) UnlockHeap(); if (rc) { - if ((flags & M_CANFAIL) == 0) + if ((flags & M_CANFAIL) != 0) return rc; StartPanic("Out of memory"); } From 99732384edb6beb48ad396eb1f881b6e39f61fe8 Mon Sep 17 00:00:00 2001 From: Julian Barathieu Date: Tue, 19 Mar 2019 13:59:06 +0100 Subject: [PATCH 02/13] Panic fix --- kaleid/include/base/assert.h | 10 ---------- kaleid/include/kernel/base.h | 4 ---- kaleid/include/kernel/panic.h | 3 ++- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/kaleid/include/base/assert.h b/kaleid/include/base/assert.h index 97fadac..3f962bd 100644 --- a/kaleid/include/base/assert.h +++ b/kaleid/include/base/assert.h @@ -84,16 +84,6 @@ noreturn void __assert_handler(const char *, const char *, int, const char *); // #define KalAssert KalAlwaysAssert -#ifndef _OSK_SOURCE - -// When not building for OS/K, use the system's assert -#include - -#undef KalAlwaysAssert -#define KalAlwaysAssert assert - -#endif - //------------------------------------------// // When not debugging // //------------------------------------------// diff --git a/kaleid/include/kernel/base.h b/kaleid/include/kernel/base.h index f951a42..f8bdf6e 100644 --- a/kaleid/include/kernel/base.h +++ b/kaleid/include/kernel/base.h @@ -60,7 +60,6 @@ typedef enum TermColor_t TermColor_t; // Get Process_t structure of current CPU #define GetCurCPU() (cpuTable[_GetCurCPU()]) -#define PANICSTR_SIZE 1024 //------------------------------------------// @@ -72,9 +71,6 @@ struct Processor_t // CPU number, index in CPU list int index; - // Panic string - char panicStr[PANICSTR_SIZE]; - // Number of ticks since boot time ulong ticks; diff --git a/kaleid/include/kernel/panic.h b/kaleid/include/kernel/panic.h index ac80e6e..cdb53be 100644 --- a/kaleid/include/kernel/panic.h +++ b/kaleid/include/kernel/panic.h @@ -31,7 +31,8 @@ //------------------------------------------// -extern volatile char *PanicStr; +#define PANICSTR_SIZE 1024 +extern volatile char PanicStr[PANICSTR_SIZE]; //------------------------------------------// From 9f4c8196cee99c13e970902fb1ac474cfc3413d9 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 19 Mar 2019 13:59:54 +0100 Subject: [PATCH 03/13] stuff --- kaleid/kernel/init/init.c | 4 ++-- kaleid/kernel/init/table.c | 2 +- kaleid/kernel/mm/map.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 466c6fb..4c0b168 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -33,8 +33,8 @@ // void InitBootInfo(multiboot_info_t *mbi) { - KalAssert(mbi); - + // We need the multiboot structure + KalAlwaysAssert(mbi); extern uint MB_header; //Retrieves the bootloader informations diff --git a/kaleid/kernel/init/table.c b/kaleid/kernel/init/table.c index 10c52de..ebca750 100644 --- a/kaleid/kernel/init/table.c +++ b/kaleid/kernel/init/table.c @@ -27,7 +27,7 @@ int cpuCount = 1; Processor_t cpuTable[NCPUS] = {0}; -BootInfo_t bootTab = {0} +BootInfo_t bootTab = {0}; Terminal_t *StdOut = 0, *StdDbg = 0; volatile char *PanicStr = 0; diff --git a/kaleid/kernel/mm/map.c b/kaleid/kernel/mm/map.c index 6d29346..ef9f2d7 100644 --- a/kaleid/kernel/mm/map.c +++ b/kaleid/kernel/mm/map.c @@ -27,8 +27,8 @@ error_t InitMemoryMap(void) { - ///uint MapIsValid = (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP = MULTIBOOT_INFO_MEM_MAP ? 1 : 0); - KalAlwaysAssert(MapIsValid); + uint mapIsValid = (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP) == MULTIBOOT_INFO_MEM_MAP; + KalAlwaysAssert(0); return EOK; } From ef1467ea469b006ad7108c50586b59b7502fe63e Mon Sep 17 00:00:00 2001 From: Julian Barathieu Date: Tue, 19 Mar 2019 14:03:13 +0100 Subject: [PATCH 04/13] Panic fix --- kaleid/kernel/init/table.c | 6 +++--- kaleid/kernel/ke/panic.c | 8 ++++---- kaleid/kernel/mm/map.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kaleid/kernel/init/table.c b/kaleid/kernel/init/table.c index 10c52de..bc32fdb 100644 --- a/kaleid/kernel/init/table.c +++ b/kaleid/kernel/init/table.c @@ -27,8 +27,8 @@ int cpuCount = 1; Processor_t cpuTable[NCPUS] = {0}; -BootInfo_t bootTab = {0} +BootInfo_t bootTab = {0}; Terminal_t *StdOut = 0, *StdDbg = 0; -volatile char *PanicStr = 0; -Terminal_t *stdOut = 0, *stdDbg = 0; +volatile char PanicStr[PANICSTR_SIZE] = {0}; + diff --git a/kaleid/kernel/ke/panic.c b/kaleid/kernel/ke/panic.c index 4de0bfe..134ab33 100644 --- a/kaleid/kernel/ke/panic.c +++ b/kaleid/kernel/ke/panic.c @@ -37,8 +37,8 @@ noreturn void __assert_handler(const char *msg, (void)file; (void)line; (void)func; - StartPanic("cpu%d: In function '%s', from %s line %d - assertion failed: '%s'", - _GetCurCPU(), func, file, line, msg); + StartPanic("In function '%s', from %s line %d - assertion failed: '%s'", + func, file, line, msg); } // @@ -64,11 +64,11 @@ noreturn void StartPanic(const char *fmt, ...) } va_start(ap, fmt); - vsnprintf(PanicStr, PANICSTR_SIZE, fmt, ap); + vsnprintf((char *)PanicStr, PANICSTR_SIZE, fmt, ap); va_end(ap); PrintOnTermUnlocked(StdOut, "\nPanic!\n\n"); - PrintOnTermUnlocked(StdOut, PanicStr); + PrintOnTermUnlocked(StdOut, (char *)PanicStr); HaltCPU(); } diff --git a/kaleid/kernel/mm/map.c b/kaleid/kernel/mm/map.c index 6d29346..27b1748 100644 --- a/kaleid/kernel/mm/map.c +++ b/kaleid/kernel/mm/map.c @@ -28,7 +28,7 @@ error_t InitMemoryMap(void) { ///uint MapIsValid = (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP = MULTIBOOT_INFO_MEM_MAP ? 1 : 0); - KalAlwaysAssert(MapIsValid); + KalAlwaysAssert(0); return EOK; } From 965d12d2cd69419690f5a5c6890b4bf055668f39 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 19 Mar 2019 14:24:33 +0100 Subject: [PATCH 05/13] stuff --- ProjectTree | 170 ----------------------------------------- kaleid/kernel/mm/map.c | 2 +- 2 files changed, 1 insertion(+), 171 deletions(-) delete mode 100644 ProjectTree diff --git a/ProjectTree b/ProjectTree deleted file mode 100644 index 72efbbb..0000000 --- a/ProjectTree +++ /dev/null @@ -1,170 +0,0 @@ -#=----------------------------------------------------------------------------=# -# GNU GPL OS/K # -# # -# Desc: # -# # -# # -# Copyright © 2018-2019 The OS/K Team # -# # -# This file is part of OS/K. # -# # -# OS/K is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# any later version. # -# # -# OS/K is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY# without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with OS/K. If not, see . # -#=----------------------------------------------------------------------------=# - - -. -├── AUTHORS -├── boot -│   ├── folder.desc -│   ├── grub -│   │   ├── create_disk.sh -│   │   ├── grub.cfg -│   │   ├── grub-install.sh -│   │   ├── mount.sh -│   │   ├── multiboot.pdf -│   │   └── umount.sh -│   └── loader -│   ├── cpu -│   │   ├── cpu32.inc -│   │   └── cpu.inc -│   ├── io -│   │   └── terminal.inc -│   ├── loader.asm -│   ├── mem -│   │   ├── management.inc -│   │   └── structures.inc -│   └── multiboot -│   ├── check.inc -│   └── header.inc -├── build -│   ├── bin -│   │   ├── disk.img -│   │   └── kaleid -│   ├── kernel.ld -│   └── obj -│   ├── boot -│   │   ├── kaleid.x86_64 -│   │   └── loader.o -│   └── kaleid -│   ├── argv.o -│   ├── atoi.o -│   ├── atol.o -│   ├── atoul.o -│   ├── atou.o -│   ├── ctype.o -│   ├── itoa.o -│   ├── kernel -│   │   ├── cpuid.o -│   │   ├── cursor.o -│   │   ├── heap.o -│   │   ├── init -│   │   │   ├── init.o -│   │   │   └── table.o -│   │   ├── init.o -│   │   ├── io -│   │   │   ├── cursor.o -│   │   │   ├── term.o -│   │   │   └── vga.o -│   │   ├── ke -│   │   │   └── panic.o -│   │   ├── malloc.o -│   │   ├── map.o -│   │   ├── panic.o -│   │   ├── table.o -│   │   ├── term.o -│   │   └── vga.o -│   ├── ltoa.o -│   ├── mem.o -│   ├── prog.o -│   ├── rand.o -│   ├── sprintf.o -│   ├── status.o -│   ├── string.o -│   ├── strtol.o -│   ├── ultoa.o -│   └── utoa.o -├── ChangeLog -├── COPYING -├── grub.log -├── kaleid -│   ├── crtlib -│   │   ├── atoi.c -│   │   ├── ctype.c -│   │   ├── itoa.c -│   │   ├── mem.c -│   │   ├── rand.c -│   │   ├── sprintf.c -│   │   ├── status.c -│   │   ├── string.c -│   │   └── strtol.c -│   ├── extras -│   │   ├── argv.c -│   │   └── prog.c -│   ├── include -│   │   ├── base -│   │   │   ├── assert.h -│   │   │   ├── bdefs.h -│   │   │   ├── crtlib.h -│   │   │   ├── errno.h -│   │   │   ├── limits.h -│   │   │   ├── masks.h -│   │   │   └── types.h -│   │   ├── extras -│   │   │   ├── argv.h -│   │   │   ├── list.h -│   │   │   ├── locks.h -│   │   │   ├── malloc.h -│   │   │   └── prog.h -│   │   ├── kalbase.h -│   │   ├── kaleid.h -│   │   ├── kalext.h -│   │   └── kernel -│   │   ├── base.h -│   │   ├── cpu.h -│   │   ├── heap.h -│   │   ├── iomisc.h -│   │   ├── mm.h -│   │   ├── multiboot.h -│   │   ├── panic.h -│   │   ├── proc.h -│   │   ├── sched.h -│   │   └── term.h -│   └── kernel -│   ├── cpu -│   │   └── cpuid.c -│   ├── init -│   │   ├── init.c -│   │   └── table.c -│   ├── io -│   │   ├── ata.inc -│   │   ├── cursor.c -│   │   ├── term.c -│   │   └── vga.c -│   ├── ke -│   │   └── panic.c -│   ├── mm -│   │   ├── heap.c -│   │   ├── malloc.c -│   │   └── map.c -│   └── proc -│   ├── Makefile -│   └── sched.c -├── loader_disasm32.asm -├── loader_disasm64.asm -├── Makefile -├── ProjectTree -├── qemu.log -└── Readme.md - -30 directories, 112 files diff --git a/kaleid/kernel/mm/map.c b/kaleid/kernel/mm/map.c index ef9f2d7..ed39670 100644 --- a/kaleid/kernel/mm/map.c +++ b/kaleid/kernel/mm/map.c @@ -28,7 +28,7 @@ error_t InitMemoryMap(void) { uint mapIsValid = (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP) == MULTIBOOT_INFO_MEM_MAP; - KalAlwaysAssert(0); + KalAlwaysAssert(mapIsValid); return EOK; } From 1aef44b1af70db0c429dc0779b5df9fbbea5eb5e Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Thu, 21 Mar 2019 13:30:17 +0100 Subject: [PATCH 06/13] Boot organization --- Makefile | 6 +-- boot/loader/loader.asm | 1 + kaleid/include/kernel/base.h | 17 +++++-- kaleid/include/kernel/mm.h | 2 + kaleid/kernel/init/init.c | 88 ++++++++++++++++++++++++------------ kaleid/kernel/mm/map.c | 12 ++++- 6 files changed, 89 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 0c75b9e..4d47d3b 100644 --- a/Makefile +++ b/Makefile @@ -165,13 +165,13 @@ $(KOBJDIR)/kernel/malloc.o: $(KERNELDIR)/kernel/mm/malloc.c ./ProjectTree: ./.stylehlp_sh @cat ./.stylehlp_sh > ./ProjectTree @echo "\n" >> ./ProjectTree - @tree >> ./ProjectTree + @tree --dirsfirst >> ./ProjectTree @echo ${CL2}[$@] ${CL}Generated.${CL3} ## MAIN MAKEFILE ------------------------------------------------------------- # .PHONY: test test: all - @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 -m 5G -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 .PHONY: test32 @@ -182,7 +182,7 @@ test32: all .PHONY: debug debug: all - @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 -m 5G -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/boot/loader/loader.asm b/boot/loader/loader.asm index 8e39fa7..8441366 100644 --- a/boot/loader/loader.asm +++ b/boot/loader/loader.asm @@ -154,6 +154,7 @@ _loader64: call write ;; Launch the kernel ! + ;; XXX CHECK THE RAM BEFORE CALLING KERNEL ! call tritemporize ; Let time to see mov rdi, [mbInfo] diff --git a/kaleid/include/kernel/base.h b/kaleid/include/kernel/base.h index 476c647..9b9ed11 100644 --- a/kaleid/include/kernel/base.h +++ b/kaleid/include/kernel/base.h @@ -102,33 +102,42 @@ struct BootInfo_t { // The Bootloader infos (GRUB in our case) struct { + ushort valid; uint grubFlags; //flags uint modulesCount; //mods_count void *modulesAddr; //mods_addr - uint grubName; //boot_loader_name + char *grubName; //boot_loader_name void *mbHeaderAddr; } btldr; // Informations about drives struct { + ushort drvValid; + ushort bufferValid; uint bootDrv; //boot_device uint bufferLength; //drives_length - void *bufferAddr; //drives_addr + void *bufferAddr; //drives_addr } drives; // Informations about memory struct { + ushort memValid; + ushort mapValid; + //BIOS provided low and up memory uint lowMemory; //mem_lower uint upMemory; //mem_upper //GRUB provided memory map uint mapLength; //mmap_length - void *mapAddr; //mmap_addr + void *mapAddr; //mmap_addr + + uint ramSize; //The ram (init by map.c) } memory; // Informations about the video drive struct { + ushort valid; uint vbeControl; //vbe_control_info uint vbeModeInfo; //vbe_mode_info ushort vbeMode; //vbe_mode @@ -145,6 +154,8 @@ struct BootInfo_t // Informations about the microcode firmware (BIOS/EFI) struct { + ushort apmValid; + ushort romValid; uint apmTable; //apm_table uint romTable; //config_table } firmware; diff --git a/kaleid/include/kernel/mm.h b/kaleid/include/kernel/mm.h index 3ef8494..49072e0 100644 --- a/kaleid/include/kernel/mm.h +++ b/kaleid/include/kernel/mm.h @@ -25,6 +25,8 @@ #include #include +#define MINIMUM_RAM_SIZE 16 //Mio, the minimum RAM size. + // // Returns a pointer to the first entry of the memory map // diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 4c0b168..998ae3b 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -29,7 +29,7 @@ // // BootInfo_t initialization. It is necessary because grub will potentially be -// wiped since it is below 1MB.... +// wiped since it is below 1MB.... And we must reorganize all that stuff. // void InitBootInfo(multiboot_info_t *mbi) { @@ -37,41 +37,69 @@ void InitBootInfo(multiboot_info_t *mbi) KalAlwaysAssert(mbi); extern uint MB_header; - //Retrieves the bootloader informations - GetBootInfo(btldr).grubFlags = mbi->flags; - GetBootInfo(btldr).grubName = (mbi->boot_loader_name); - GetBootInfo(btldr).modulesCount = mbi->mods_count; - GetBootInfo(btldr).modulesAddr = (void*)(ullong)mbi->mods_addr; - GetBootInfo(btldr).mbHeaderAddr = (void*)(ullong)&MB_header; - DebugLog("\n[InitBootInfo] %s\n", GetBootInfo(btldr).grubName); - DebugLog("[InitBootInfo] Header address : %p, modules address : %p\n", - GetBootInfo(btldr).mbHeaderAddr, GetBootInfo(btldr).modulesAddr); - DebugLog("[InitBootInfo] GRUB flags : %x\n", GetBootInfo(btldr).grubFlags); + //Retrieves the bootloader flags to ensure infos are valid + GetBootInfo(btldr).grubFlags = mbi->flags; + if ( + (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) == MULTIBOOT_INFO_BOOT_LOADER_NAME && + (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MODS) == MULTIBOOT_INFO_MODS + ) { + GetBootInfo(btldr).grubName = (char*)(ullong)(mbi->boot_loader_name); + GetBootInfo(btldr).modulesCount = mbi->mods_count; + GetBootInfo(btldr).modulesAddr = (void*)(ullong)mbi->mods_addr; + GetBootInfo(btldr).mbHeaderAddr = (void*)(ullong)&MB_header; + GetBootInfo(btldr).valid = 1; + } //Retrieves the drives informations - GetBootInfo(drives).bootDrv = mbi->boot_device; - GetBootInfo(drives).bufferLength = mbi->drives_length; - GetBootInfo(drives).bufferAddr = (void*)(ullong)mbi->drives_addr; - DebugLog("[InitBootInfo] Root drive : %x\n", - GetBootInfo(drives).bootDrv); + if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_DRIVE_INFO) == MULTIBOOT_INFO_DRIVE_INFO) { + GetBootInfo(drives).bufferLength = mbi->drives_length; + GetBootInfo(drives).bufferAddr = (void*)(ullong)mbi->drives_addr; + GetBootInfo(drives).bufferValid = 1; + } + if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOTDEV) == MULTIBOOT_INFO_BOOTDEV) { + GetBootInfo(drives).bootDrv = mbi->boot_device; + GetBootInfo(drives).drvValid = 1; + } //Retrieves the memory informations - GetBootInfo(memory).lowMemory = mbi->mem_lower; - GetBootInfo(memory).upMemory = mbi->mem_upper; - GetBootInfo(memory).mapAddr = (void*)(ullong)mbi->mmap_addr; - GetBootInfo(memory).mapLength = mbi->mmap_length; - DebugLog("[InitBootInfo] Low memory : %d Kio, Up memory : %d Mio\n", - GetBootInfo(memory).lowMemory, GetBootInfo(memory).upMemory / (MB/KB)); - DebugLog("[InitBootInfo] Memory map address : %p, length : %d\n", - GetBootInfo(memory).mapAddr, GetBootInfo(memory).mapLength); + if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEMORY) == MULTIBOOT_INFO_MEMORY) { + GetBootInfo(memory).lowMemory = mbi->mem_lower; + GetBootInfo(memory).upMemory = mbi->mem_upper; + GetBootInfo(memory).memValid = 1; + } + if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP) == MULTIBOOT_INFO_MEM_MAP) { + GetBootInfo(memory).mapAddr = (void*)(ullong)mbi->mmap_addr; + GetBootInfo(memory).mapLength = mbi->mmap_length; + GetBootInfo(memory).mapValid = 1; + } // XXX assign video infos, but unused at this time // Retrieves the firmware infos - GetBootInfo(firmware).apmTable = mbi->apm_table; - GetBootInfo(firmware).romTable = mbi->config_table; - DebugLog("[InitBootInfo] APM Table : %p, ROM Table : %p\n", - GetBootInfo(firmware).apmTable, GetBootInfo(firmware).romTable); + if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_CONFIG_TABLE) == MULTIBOOT_INFO_CONFIG_TABLE) { + GetBootInfo(firmware).romTable = mbi->config_table; + GetBootInfo(firmware).romValid = 1; + } + if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_APM_TABLE ) == MULTIBOOT_INFO_APM_TABLE ) { + GetBootInfo(firmware).apmTable = mbi->apm_table; + GetBootInfo(firmware).apmValid = 1; + } + + //Now we check (debug) + DebugLog("\n[InitBootInfo] Boot loader %s", + GetBootInfo(btldr).valid ? "OK" : ""); + DebugLog("\n[InitBootInfo] Boot drive %s", + GetBootInfo(drives).drvValid ? "OK" : ""); + DebugLog("\n[InitBootInfo] Disk buffer %s", + GetBootInfo(drives).bufferValid ? "OK" : ""); + DebugLog("\n[InitBootInfo] Basic mem %s", + GetBootInfo(memory).memValid ? "OK" : ""); + DebugLog("\n[InitBootInfo] Memory map %s", + GetBootInfo(memory).mapValid ? "OK" : ""); + DebugLog("\n[InitBootInfo] ROM table %s", + GetBootInfo(firmware).romValid ? "OK" : ""); + DebugLog("\n[InitBootInfo] APM table %s", + GetBootInfo(firmware).apmValid ? "OK\n" : "\n"); } @@ -96,7 +124,9 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic) InitBootInfo(mbInfo); //Memory mapping - InitMemoryMap(); + error_t mapBad = InitMemoryMap(); + if (mapBad) + StartPanic("[Init] The memory map failed to initialize. Error : %d", mapBad); // We're out KernLog("\n[Init] Evil never dies !"); diff --git a/kaleid/kernel/mm/map.c b/kaleid/kernel/mm/map.c index ed39670..5ea56c6 100644 --- a/kaleid/kernel/mm/map.c +++ b/kaleid/kernel/mm/map.c @@ -27,8 +27,16 @@ error_t InitMemoryMap(void) { - uint mapIsValid = (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP) == MULTIBOOT_INFO_MEM_MAP; - KalAlwaysAssert(mapIsValid); + if (!GetBootInfo(memory).memValid && GetBootInfo(memory).mapValid) + return ENXIO; + DebugLog("[InitMemoryMap] Memory map address : %p, length : %d\n", + GetBootInfo(memory).mapAddr, GetBootInfo(memory).mapLength); + + if ((GetBootInfo(memory).upMemory / (MB/KB)) <= MINIMUM_RAM_SIZE) //XXX before loading kernel... + return ENOMEM; + DebugLog("[InitMemoryMap] Low memory : %d Kio, Up memory : %d Mio\n", + GetBootInfo(memory).lowMemory, GetBootInfo(memory).upMemory / (MB/KB)); + return EOK; } From 5a1de9020823d2e345c8e5bf99c9a6bc56a6cf50 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Thu, 21 Mar 2019 13:30:27 +0100 Subject: [PATCH 07/13] Boot organization --- ProjectTree | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 ProjectTree diff --git a/ProjectTree b/ProjectTree new file mode 100644 index 0000000..74b8d52 --- /dev/null +++ b/ProjectTree @@ -0,0 +1,170 @@ +#=----------------------------------------------------------------------------=# +# GNU GPL OS/K # +# # +# Desc: # +# # +# # +# Copyright © 2018-2019 The OS/K Team # +# # +# This file is part of OS/K. # +# # +# OS/K is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# any later version. # +# # +# OS/K is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY# without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with OS/K. If not, see . # +#=----------------------------------------------------------------------------=# + + +. +├── boot +│   ├── grub +│   │   ├── create_disk.sh +│   │   ├── grub.cfg +│   │   ├── grub-install.sh +│   │   ├── mount.sh +│   │   ├── multiboot.pdf +│   │   └── umount.sh +│   ├── loader +│   │   ├── cpu +│   │   │   ├── cpu32.inc +│   │   │   └── cpu.inc +│   │   ├── io +│   │   │   └── terminal.inc +│   │   ├── mem +│   │   │   ├── management.inc +│   │   │   └── structures.inc +│   │   ├── multiboot +│   │   │   ├── check.inc +│   │   │   └── header.inc +│   │   └── loader.asm +│   └── folder.desc +├── build +│   ├── bin +│   │   ├── disk.img +│   │   └── kaleid +│   ├── obj +│   │   ├── boot +│   │   │   ├── kaleid.x86_64 +│   │   │   └── loader.o +│   │   └── kaleid +│   │   ├── kernel +│   │   │   ├── init +│   │   │   │   ├── init.o +│   │   │   │   └── table.o +│   │   │   ├── io +│   │   │   │   ├── cursor.o +│   │   │   │   ├── term.o +│   │   │   │   └── vga.o +│   │   │   ├── ke +│   │   │   │   └── panic.o +│   │   │   ├── cpuid.o +│   │   │   ├── cursor.o +│   │   │   ├── heap.o +│   │   │   ├── init.o +│   │   │   ├── malloc.o +│   │   │   ├── map.o +│   │   │   ├── panic.o +│   │   │   ├── table.o +│   │   │   ├── term.o +│   │   │   └── vga.o +│   │   ├── argv.o +│   │   ├── atoi.o +│   │   ├── atol.o +│   │   ├── atoul.o +│   │   ├── atou.o +│   │   ├── ctype.o +│   │   ├── itoa.o +│   │   ├── ltoa.o +│   │   ├── mem.o +│   │   ├── prog.o +│   │   ├── rand.o +│   │   ├── sprintf.o +│   │   ├── status.o +│   │   ├── string.o +│   │   ├── strtol.o +│   │   ├── ultoa.o +│   │   └── utoa.o +│   └── kernel.ld +├── kaleid +│   ├── crtlib +│   │   ├── atoi.c +│   │   ├── ctype.c +│   │   ├── itoa.c +│   │   ├── mem.c +│   │   ├── rand.c +│   │   ├── sprintf.c +│   │   ├── status.c +│   │   ├── string.c +│   │   └── strtol.c +│   ├── extras +│   │   ├── argv.c +│   │   └── prog.c +│   ├── include +│   │   ├── base +│   │   │   ├── assert.h +│   │   │   ├── bdefs.h +│   │   │   ├── crtlib.h +│   │   │   ├── errno.h +│   │   │   ├── limits.h +│   │   │   ├── masks.h +│   │   │   └── types.h +│   │   ├── extras +│   │   │   ├── argv.h +│   │   │   ├── list.h +│   │   │   ├── locks.h +│   │   │   ├── malloc.h +│   │   │   └── prog.h +│   │   ├── kernel +│   │   │   ├── base.h +│   │   │   ├── cpu.h +│   │   │   ├── heap.h +│   │   │   ├── iomisc.h +│   │   │   ├── mm.h +│   │   │   ├── multiboot.h +│   │   │   ├── panic.h +│   │   │   ├── proc.h +│   │   │   ├── sched.h +│   │   │   └── term.h +│   │   ├── kalbase.h +│   │   ├── kaleid.h +│   │   └── kalext.h +│   └── kernel +│   ├── cpu +│   │   └── cpuid.c +│   ├── init +│   │   ├── init.c +│   │   └── table.c +│   ├── io +│   │   ├── ata.inc +│   │   ├── cursor.c +│   │   ├── term.c +│   │   └── vga.c +│   ├── ke +│   │   └── panic.c +│   ├── mm +│   │   ├── heap.c +│   │   ├── malloc.c +│   │   └── map.c +│   └── proc +│   ├── Makefile +│   └── sched.c +├── AUTHORS +├── ChangeLog +├── COPYING +├── grub.log +├── loader_disasm32.asm +├── loader_disasm64.asm +├── Makefile +├── ProjectTree +├── qemu.log +└── Readme.md + +30 directories, 112 files From 53be658a4a09a56d8678c63a9128e2d94798b4af Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 22 Mar 2019 13:18:20 +0100 Subject: [PATCH 08/13] stuff --- kaleid/kernel/mm/malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kaleid/kernel/mm/malloc.c b/kaleid/kernel/mm/malloc.c index e63fa77..58f8bf3 100644 --- a/kaleid/kernel/mm/malloc.c +++ b/kaleid/kernel/mm/malloc.c @@ -66,6 +66,6 @@ error_t KalAllocMemory(void **ptr, size_t req, int flags, size_t align) error_t KalFreeMemory(void *ptr) { (void)ptr; - return 0; + return EOK; } From 5fc538c9d2ae15068abd8cb594c88278836bbba6 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 22 Mar 2019 15:03:41 +0100 Subject: [PATCH 09/13] stuff ! --- boot/loader/loader.asm | 19 ++++++++++------ boot/loader/multiboot/header.inc | 7 +++++- kaleid/kernel/init/init.c | 37 ++++++++++++++++---------------- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/boot/loader/loader.asm b/boot/loader/loader.asm index 8441366..a15920c 100644 --- a/boot/loader/loader.asm +++ b/boot/loader/loader.asm @@ -44,6 +44,11 @@ MB_header: dd MB_HEADER_MAGIC dd MB_HEADER_FLAGS dd CHECKSUM + times 5 dd 0x0 + dd MB_VIDEO_MODE + dd MB_VIDEO_WIDTH + dd MB_VIDEO_HEIGHT + dd MB_VIDEO_DEPTH [section .text] @@ -71,7 +76,7 @@ Error: call write32 pop esi jmp Die -.ergo : db 219, 219, 219, " Error " +.ergo : db 219, 219, 219, " OS/K Loader Error " .code : db "00" db 0x0 ; ---------------------------------------------------------------------------- ; @@ -104,6 +109,12 @@ mbMagic dq 0 lbegin: call clear ; Clear the screen + push esi ; Print the logo + mov bl, 0x0E + mov esi, LOGO + call write32 + pop esi + ;; BEGIN OF CHECKLIST call MB_check ; Check Multiboot State, ERR 01 @@ -115,12 +126,6 @@ lbegin: call Setup_paging ; Enable paging call Go64 ; Prepare switch into long mode - push esi ; Print the logo - mov bl, 0x0E - mov esi, LOGO - call write32 - pop esi - ;call disable_cursor lgdt [GDT64.pointer] diff --git a/boot/loader/multiboot/header.inc b/boot/loader/multiboot/header.inc index 06f89a4..0cfea0c 100644 --- a/boot/loader/multiboot/header.inc +++ b/boot/loader/multiboot/header.inc @@ -27,8 +27,13 @@ MB_AOUT_KLUDGE equ 0 << 16 ; if we are not an ELF executable MB_ALIGN equ 1 << 0 ; Ask to align loaded modules on page boundaries MB_MEMINFO equ 1 << 1 ; Ask to provide memory map +MB_VIDEOINFO equ 1 << 2 ; Ask to provide video infos +MB_VIDEO_MODE equ 0x1 ; Text mode +MB_VIDEO_WIDTH equ 80 +MB_VIDEO_HEIGHT equ 24 +MB_VIDEO_DEPTH equ 0x0 MB_HEADER_MAGIC equ 0x1badb002 MB_GRUB_MAGIC equ 0x2badb002 -MB_HEADER_FLAGS equ MB_AOUT_KLUDGE|MB_ALIGN|MB_MEMINFO +MB_HEADER_FLAGS equ MB_AOUT_KLUDGE|MB_ALIGN|MB_MEMINFO|MB_VIDEOINFO CHECKSUM equ -(MB_HEADER_MAGIC + MB_HEADER_FLAGS) KERNEL_STACK equ 0x00200000 ; Stack starts at the 2mb address & grows down diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 998ae3b..a74e80e 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -40,34 +40,33 @@ void InitBootInfo(multiboot_info_t *mbi) //Retrieves the bootloader flags to ensure infos are valid GetBootInfo(btldr).grubFlags = mbi->flags; - if ( - (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) == MULTIBOOT_INFO_BOOT_LOADER_NAME && - (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MODS) == MULTIBOOT_INFO_MODS - ) { + if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) { GetBootInfo(btldr).grubName = (char*)(ullong)(mbi->boot_loader_name); - GetBootInfo(btldr).modulesCount = mbi->mods_count; - GetBootInfo(btldr).modulesAddr = (void*)(ullong)mbi->mods_addr; GetBootInfo(btldr).mbHeaderAddr = (void*)(ullong)&MB_header; GetBootInfo(btldr).valid = 1; } + if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MODS) { + GetBootInfo(btldr).modulesCount = mbi->mods_count; + GetBootInfo(btldr).modulesAddr = (void*)(ullong)mbi->mods_addr; + } //Retrieves the drives informations - if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_DRIVE_INFO) == MULTIBOOT_INFO_DRIVE_INFO) { + if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_DRIVE_INFO) { GetBootInfo(drives).bufferLength = mbi->drives_length; GetBootInfo(drives).bufferAddr = (void*)(ullong)mbi->drives_addr; GetBootInfo(drives).bufferValid = 1; } - if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOTDEV) == MULTIBOOT_INFO_BOOTDEV) { + if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOTDEV) { GetBootInfo(drives).bootDrv = mbi->boot_device; GetBootInfo(drives).drvValid = 1; } //Retrieves the memory informations - if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEMORY) == MULTIBOOT_INFO_MEMORY) { + if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEMORY) { GetBootInfo(memory).lowMemory = mbi->mem_lower; GetBootInfo(memory).upMemory = mbi->mem_upper; GetBootInfo(memory).memValid = 1; } - if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP) == MULTIBOOT_INFO_MEM_MAP) { + if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP) { GetBootInfo(memory).mapAddr = (void*)(ullong)mbi->mmap_addr; GetBootInfo(memory).mapLength = mbi->mmap_length; GetBootInfo(memory).mapValid = 1; @@ -76,30 +75,30 @@ void InitBootInfo(multiboot_info_t *mbi) // XXX assign video infos, but unused at this time // Retrieves the firmware infos - if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_CONFIG_TABLE) == MULTIBOOT_INFO_CONFIG_TABLE) { + if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_CONFIG_TABLE) { GetBootInfo(firmware).romTable = mbi->config_table; GetBootInfo(firmware).romValid = 1; } - if ((GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_APM_TABLE ) == MULTIBOOT_INFO_APM_TABLE ) { + if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_APM_TABLE) { GetBootInfo(firmware).apmTable = mbi->apm_table; GetBootInfo(firmware).apmValid = 1; } //Now we check (debug) DebugLog("\n[InitBootInfo] Boot loader %s", - GetBootInfo(btldr).valid ? "OK" : ""); + GetBootInfo(btldr).valid ? "present" : ""); DebugLog("\n[InitBootInfo] Boot drive %s", - GetBootInfo(drives).drvValid ? "OK" : ""); + GetBootInfo(drives).drvValid ? "present" : ""); DebugLog("\n[InitBootInfo] Disk buffer %s", - GetBootInfo(drives).bufferValid ? "OK" : ""); + GetBootInfo(drives).bufferValid ? "present" : ""); DebugLog("\n[InitBootInfo] Basic mem %s", - GetBootInfo(memory).memValid ? "OK" : ""); + GetBootInfo(memory).memValid ? "present" : ""); DebugLog("\n[InitBootInfo] Memory map %s", - GetBootInfo(memory).mapValid ? "OK" : ""); + GetBootInfo(memory).mapValid ? "present" : ""); DebugLog("\n[InitBootInfo] ROM table %s", - GetBootInfo(firmware).romValid ? "OK" : ""); + GetBootInfo(firmware).romValid ? "present" : ""); DebugLog("\n[InitBootInfo] APM table %s", - GetBootInfo(firmware).apmValid ? "OK\n" : "\n"); + GetBootInfo(firmware).apmValid ? "present\n" : "\n"); } From bc82695e267bc668d5b34d9f11fbf0d015f78911 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 22 Mar 2019 15:16:37 +0100 Subject: [PATCH 10/13] stuff ! --- kaleid/kernel/init/init.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index a74e80e..67055aa 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -33,9 +33,12 @@ // void InitBootInfo(multiboot_info_t *mbi) { + extern uint MB_header; + char okStr[] = "available"; + char noStr[] = "unavailable"; + // We need the multiboot structure KalAlwaysAssert(mbi); - extern uint MB_header; //Retrieves the bootloader flags to ensure infos are valid GetBootInfo(btldr).grubFlags = mbi->flags; @@ -85,20 +88,23 @@ void InitBootInfo(multiboot_info_t *mbi) } //Now we check (debug) + DebugLog("\n[InitBootInfo] Flags : %b", + GetBootInfo(btldr).grubFlags); DebugLog("\n[InitBootInfo] Boot loader %s", - GetBootInfo(btldr).valid ? "present" : ""); + GetBootInfo(btldr).valid ? &okStr : &noStr); DebugLog("\n[InitBootInfo] Boot drive %s", - GetBootInfo(drives).drvValid ? "present" : ""); + GetBootInfo(drives).drvValid ? &okStr : &noStr); DebugLog("\n[InitBootInfo] Disk buffer %s", - GetBootInfo(drives).bufferValid ? "present" : ""); + GetBootInfo(drives).bufferValid ? &okStr : &noStr); DebugLog("\n[InitBootInfo] Basic mem %s", - GetBootInfo(memory).memValid ? "present" : ""); + GetBootInfo(memory).memValid ? &okStr : &noStr); DebugLog("\n[InitBootInfo] Memory map %s", - GetBootInfo(memory).mapValid ? "present" : ""); + GetBootInfo(memory).mapValid ? &okStr : &noStr); DebugLog("\n[InitBootInfo] ROM table %s", - GetBootInfo(firmware).romValid ? "present" : ""); + GetBootInfo(firmware).romValid ? &okStr : &noStr); DebugLog("\n[InitBootInfo] APM table %s", - GetBootInfo(firmware).apmValid ? "present\n" : "\n"); + GetBootInfo(firmware).apmValid ? &okStr : &noStr); + DebugLog("\n"); } From 858ed26e78b50e30a5d0130f3ee1b131c6645405 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 22 Mar 2019 15:42:02 +0100 Subject: [PATCH 11/13] clean-up --- kaleid/kernel/init/init.c | 40 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 67055aa..7941eb6 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -22,7 +22,6 @@ // along with OS/K. If not, see . // //----------------------------------------------------------------------------// -#include #include #include #include @@ -34,8 +33,8 @@ void InitBootInfo(multiboot_info_t *mbi) { extern uint MB_header; - char okStr[] = "available"; - char noStr[] = "unavailable"; + char *okStr = "available"; + char *noStr = "unavailable"; // We need the multiboot structure KalAlwaysAssert(mbi); @@ -88,23 +87,22 @@ void InitBootInfo(multiboot_info_t *mbi) } //Now we check (debug) - DebugLog("\n[InitBootInfo] Flags : %b", - GetBootInfo(btldr).grubFlags); - DebugLog("\n[InitBootInfo] Boot loader %s", - GetBootInfo(btldr).valid ? &okStr : &noStr); - DebugLog("\n[InitBootInfo] Boot drive %s", - GetBootInfo(drives).drvValid ? &okStr : &noStr); - DebugLog("\n[InitBootInfo] Disk buffer %s", - GetBootInfo(drives).bufferValid ? &okStr : &noStr); - DebugLog("\n[InitBootInfo] Basic mem %s", - GetBootInfo(memory).memValid ? &okStr : &noStr); - DebugLog("\n[InitBootInfo] Memory map %s", - GetBootInfo(memory).mapValid ? &okStr : &noStr); - DebugLog("\n[InitBootInfo] ROM table %s", - GetBootInfo(firmware).romValid ? &okStr : &noStr); - DebugLog("\n[InitBootInfo] APM table %s", - GetBootInfo(firmware).apmValid ? &okStr : &noStr); - DebugLog("\n"); + /*DebugLog("[InitBootInfo] Flags : %b\n\n", + GetBootInfo(btldr).grubFlags);*/ + DebugLog("[InitBootInfo] Boot loader %s\n", + GetBootInfo(btldr).valid ? okStr : noStr); + DebugLog("[InitBootInfo] Boot drive %s\n", + GetBootInfo(drives).drvValid ? okStr : noStr); + DebugLog("[InitBootInfo] Disk buffer %s\n", + GetBootInfo(drives).bufferValid ? okStr : noStr); + DebugLog("[InitBootInfo] Basic mem %s\n", + GetBootInfo(memory).memValid ? okStr : noStr); + DebugLog("[InitBootInfo] Memory map %s\n", + GetBootInfo(memory).mapValid ? okStr : noStr); + DebugLog("[InitBootInfo] ROM table %s\n", + GetBootInfo(firmware).romValid ? okStr : noStr); + DebugLog("[InitBootInfo] APM table %s\n\n", + GetBootInfo(firmware).apmValid ? okStr : noStr); } @@ -123,7 +121,7 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic) KernLog("%c%c%c OS/K\n\n", 219, 219, 219); KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC); - KernLog("[Init] We have magic : %x\n", mbMagic); + KernLog("[Init] We have magic : %x\n\n", mbMagic); //Initialize the BootInfo_t structure InitBootInfo(mbInfo); From d39c8297557f6d0de1f9c218997700f222334bb1 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 22 Mar 2019 23:51:48 +0100 Subject: [PATCH 12/13] Makefile stuff --- Makefile | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 4d47d3b..b188beb 100644 --- a/Makefile +++ b/Makefile @@ -71,55 +71,55 @@ kal_com_obj= $(KOBJDIR)/atoi.o $(KOBJDIR)/ctype.o \ $(KOBJDIR)/utoa.o $(KOBJDIR)/ltoa.o \ $(KOBJDIR)/ultoa.o -$(KOBJDIR)/atoi.o: $(KERNELDIR)/crtlib/atoi.c +$(KOBJDIR)/atoi.o: $(KERNELDIR)/crtlib/atoi.c $(KERNELDIR)/include/*/*.h @$(KCC) -D_NEED_ATOI $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/atol.o: $(KERNELDIR)/crtlib/atoi.c +$(KOBJDIR)/atol.o: $(KERNELDIR)/crtlib/atoi.c $(KERNELDIR)/include/*/*.h @$(KCC) -D_NEED_ATOL $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/atou.o: $(KERNELDIR)/crtlib/atoi.c +$(KOBJDIR)/atou.o: $(KERNELDIR)/crtlib/atoi.c $(KERNELDIR)/include/*/*.h @$(KCC) -D_NEED_ATOU $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/atoul.o: $(KERNELDIR)/crtlib/atoi.c +$(KOBJDIR)/atoul.o: $(KERNELDIR)/crtlib/atoi.c $(KERNELDIR)/include/*/*.h @$(KCC) -D_NEED_ATOUL $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/ctype.o: $(KERNELDIR)/crtlib/ctype.c +$(KOBJDIR)/ctype.o: $(KERNELDIR)/crtlib/ctype.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/itoa.o: $(KERNELDIR)/crtlib/itoa.c +$(KOBJDIR)/itoa.o: $(KERNELDIR)/crtlib/itoa.c $(KERNELDIR)/include/*/*.h @$(KCC) -D_NEED_ITOA $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/ltoa.o: $(KERNELDIR)/crtlib/itoa.c +$(KOBJDIR)/ltoa.o: $(KERNELDIR)/crtlib/itoa.c $(KERNELDIR)/include/*/*.h @$(KCC) -D_NEED_LTOA $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/utoa.o: $(KERNELDIR)/crtlib/itoa.c +$(KOBJDIR)/utoa.o: $(KERNELDIR)/crtlib/itoa.c $(KERNELDIR)/include/*/*.h @$(KCC) -D_NEED_UTOA $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/ultoa.o: $(KERNELDIR)/crtlib/itoa.c +$(KOBJDIR)/ultoa.o: $(KERNELDIR)/crtlib/itoa.c $(KERNELDIR)/include/*/*.h @$(KCC) -D_NEED_ULTOA $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/mem.o: $(KERNELDIR)/crtlib/mem.c +$(KOBJDIR)/mem.o: $(KERNELDIR)/crtlib/mem.c $(KERNELDIR)/include/*/*.h @$(KCC) -fno-strict-aliasing $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/rand.o: $(KERNELDIR)/crtlib/rand.c +$(KOBJDIR)/rand.o: $(KERNELDIR)/crtlib/rand.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/sprintf.o: $(KERNELDIR)/crtlib/sprintf.c +$(KOBJDIR)/sprintf.o: $(KERNELDIR)/crtlib/sprintf.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/status.o: $(KERNELDIR)/crtlib/status.c +$(KOBJDIR)/status.o: $(KERNELDIR)/crtlib/status.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/string.o: $(KERNELDIR)/crtlib/string.c +$(KOBJDIR)/string.o: $(KERNELDIR)/crtlib/string.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/strtol.o: $(KERNELDIR)/crtlib/strtol.c +$(KOBJDIR)/strtol.o: $(KERNELDIR)/crtlib/strtol.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/argv.o: $(KERNELDIR)/extras/argv.c +$(KOBJDIR)/argv.o: $(KERNELDIR)/extras/argv.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/prog.o: $(KERNELDIR)/extras/prog.c +$(KOBJDIR)/prog.o: $(KERNELDIR)/extras/prog.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} @@ -130,34 +130,34 @@ kal_kern_obj= $(KOBJDIR)/kernel/cpuid.o $(KOBJDIR)/kernel/init.o \ $(KOBJDIR)/kernel/panic.o $(KOBJDIR)/kernel/map.o \ $(KOBJDIR)/kernel/heap.o $(KOBJDIR)/kernel/malloc.o -$(KOBJDIR)/kernel/cpuid.o: $(KERNELDIR)/kernel/cpu/cpuid.c +$(KOBJDIR)/kernel/cpuid.o: $(KERNELDIR)/kernel/cpu/cpuid.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/init.o: $(KERNELDIR)/kernel/init/init.c +$(KOBJDIR)/kernel/init.o: $(KERNELDIR)/kernel/init/init.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/table.o: $(KERNELDIR)/kernel/init/table.c +$(KOBJDIR)/kernel/table.o: $(KERNELDIR)/kernel/init/table.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/cursor.o: $(KERNELDIR)/kernel/io/cursor.c +$(KOBJDIR)/kernel/cursor.o: $(KERNELDIR)/kernel/io/cursor.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/term.o: $(KERNELDIR)/kernel/io/term.c +$(KOBJDIR)/kernel/term.o: $(KERNELDIR)/kernel/io/term.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/vga.o: $(KERNELDIR)/kernel/io/vga.c +$(KOBJDIR)/kernel/vga.o: $(KERNELDIR)/kernel/io/vga.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/panic.o: $(KERNELDIR)/kernel/ke/panic.c +$(KOBJDIR)/kernel/panic.o: $(KERNELDIR)/kernel/ke/panic.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/map.o: $(KERNELDIR)/kernel/mm/map.c +$(KOBJDIR)/kernel/map.o: $(KERNELDIR)/kernel/mm/map.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/heap.o: $(KERNELDIR)/kernel/mm/heap.c +$(KOBJDIR)/kernel/heap.o: $(KERNELDIR)/kernel/mm/heap.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} -$(KOBJDIR)/kernel/malloc.o: $(KERNELDIR)/kernel/mm/malloc.c +$(KOBJDIR)/kernel/malloc.o: $(KERNELDIR)/kernel/mm/malloc.c $(KERNELDIR)/include/*/*.h @$(KCC) $< -o $@ @echo ${CL2}[$@] ${CL}Compiled.${CL3} From 75262f81ee80053a60d613f02a9eee9e73c1beb0 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Sat, 23 Mar 2019 00:07:05 +0100 Subject: [PATCH 13/13] Makefile stuff --- Makefile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index b188beb..a5bfb2f 100644 --- a/Makefile +++ b/Makefile @@ -61,14 +61,14 @@ all : OS/K ## KALEID MAKEFILE ----------------------------------------------------------- # # Common objects -kal_com_obj= $(KOBJDIR)/atoi.o $(KOBJDIR)/ctype.o \ - $(KOBJDIR)/itoa.o $(KOBJDIR)/mem.o \ - $(KOBJDIR)/rand.o $(KOBJDIR)/sprintf.o \ - $(KOBJDIR)/status.o $(KOBJDIR)/string.o \ - $(KOBJDIR)/strtol.o $(KOBJDIR)/argv.o \ - $(KOBJDIR)/prog.o $(KOBJDIR)/atol.o \ - $(KOBJDIR)/atou.o $(KOBJDIR)/atoul.o \ - $(KOBJDIR)/utoa.o $(KOBJDIR)/ltoa.o \ +kal_com_obj= $(KOBJDIR)/atoi.o $(KOBJDIR)/ctype.o \ + $(KOBJDIR)/itoa.o $(KOBJDIR)/mem.o \ + $(KOBJDIR)/rand.o $(KOBJDIR)/sprintf.o \ + $(KOBJDIR)/status.o $(KOBJDIR)/string.o \ + $(KOBJDIR)/strtol.o $(KOBJDIR)/argv.o \ + $(KOBJDIR)/prog.o $(KOBJDIR)/atol.o \ + $(KOBJDIR)/atou.o $(KOBJDIR)/atoul.o \ + $(KOBJDIR)/utoa.o $(KOBJDIR)/ltoa.o \ $(KOBJDIR)/ultoa.o $(KOBJDIR)/atoi.o: $(KERNELDIR)/crtlib/atoi.c $(KERNELDIR)/include/*/*.h @@ -124,10 +124,10 @@ $(KOBJDIR)/prog.o: $(KERNELDIR)/extras/prog.c $(KERNELDIR)/include/*/*.h @echo ${CL2}[$@] ${CL}Compiled.${CL3} # Kernel objects -kal_kern_obj= $(KOBJDIR)/kernel/cpuid.o $(KOBJDIR)/kernel/init.o \ - $(KOBJDIR)/kernel/table.o $(KOBJDIR)/kernel/cursor.o \ - $(KOBJDIR)/kernel/term.o $(KOBJDIR)/kernel/vga.o \ - $(KOBJDIR)/kernel/panic.o $(KOBJDIR)/kernel/map.o \ +kal_kern_obj= $(KOBJDIR)/kernel/cpuid.o $(KOBJDIR)/kernel/init.o \ + $(KOBJDIR)/kernel/table.o $(KOBJDIR)/kernel/cursor.o \ + $(KOBJDIR)/kernel/term.o $(KOBJDIR)/kernel/vga.o \ + $(KOBJDIR)/kernel/panic.o $(KOBJDIR)/kernel/map.o \ $(KOBJDIR)/kernel/heap.o $(KOBJDIR)/kernel/malloc.o $(KOBJDIR)/kernel/cpuid.o: $(KERNELDIR)/kernel/cpu/cpuid.c $(KERNELDIR)/include/*/*.h