diff --git a/src/kaleid/common/assert.h b/src/kaleid/common/assert.h index da80ace..8c18ad6 100644 --- a/src/kaleid/common/assert.h +++ b/src/kaleid/common/assert.h @@ -11,7 +11,7 @@ #define _KALCOMM_ASSERT_H #ifndef _KALCOMM_COMMON_H -#error "don't include common/types.h without common/common.h" +# error "don't include common/types.h without common/common.h" #endif #ifdef _OSK_SOURCE @@ -26,11 +26,11 @@ noreturn void ___assert_handler(const char *, const char *, int, const char *); #else // not debugging #if !defined(NDEBUG) -#define NDEBUG 1 +# define NDEBUG 1 #endif #if !defined(_NO_DEBUG) -#define _NO_DEBUG 1 +# define _NO_DEBUG 1 #endif #define assert(x) @@ -40,7 +40,7 @@ noreturn void ___assert_handler(const char *, const char *, int, const char *); #else // !defined(_OSK_SOURCE) #if defined(_NO_DEBUG) && !defined(NDEBUG) -#define NDEBUG 1 +# define NDEBUG 1 #endif #include diff --git a/src/kaleid/common/atomic.h b/src/kaleid/common/atomic.h index a1daef3..f520339 100644 --- a/src/kaleid/common/atomic.h +++ b/src/kaleid/common/atomic.h @@ -11,7 +11,7 @@ #define _KALCOMM_ATOMIC_H #ifndef _KALCOMM_COMMON_H -#error "don't include common/types.h without common/common.h" +# error "don't include common/types.h without common/common.h" #endif // atomic_t defined in common/types.h diff --git a/src/kaleid/common/common.h b/src/kaleid/common/common.h index 9c9dd6a..52c3b44 100644 --- a/src/kaleid/common/common.h +++ b/src/kaleid/common/common.h @@ -11,7 +11,7 @@ #define _KALCOMM_COMMON_H #if !defined(_OSK_SOURCE) && (defined(_KALEID_KERNEL) || defined(_KALEID_SYSTEM)) -#define _OSK_SOURCE 1 +# define _OSK_SOURCE 1 #endif #if !defined(TRUE) && !defined(FALSE) @@ -41,8 +41,11 @@ # define unlikely(x) __builtin_expect((x), 0) #endif +#ifdef _KALEID_KERNEL +# include "kernel/config.h" +#endif + #include "common/types.h" -#include "common/config.h" #include "common/atomic.h" #include "common/status.h" #include "common/assert.h" diff --git a/src/kaleid/common/folder.desc b/src/kaleid/common/folder.desc index 8b13789..651f5a9 100644 --- a/src/kaleid/common/folder.desc +++ b/src/kaleid/common/folder.desc @@ -1 +1,41 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Authors: spectral` // +// NeoX // +// // +// Desc: Folder description - "kaleid/common" // +//----------------------------------------------------------------------------// + +This is the folder containing the sources for Kaleid's C runtime library, linked both to the kernel +and to the system processes that run outiside the kernel. It can also be compiled for Linux as +(very basic) C library, for test purposes. + +This folder contains the following files: + - common.h + This file is to be included by every source file using the library, and it includes in turn + the following files: + - assert.h + Defines the macro "assert()". Currently any program wanting to use this macro has to + implement its own "___assert_handler(const char *cond, const char *file, int line, const char *func)" + but an (overridable) default handler will be furnished in the future. + - atomic.h + Support for atomic operations. When compiled by the kernel, also furnishes macros for + enabling/disabling interrupts. This will change in the future. + - status.h + Defines the different values of the "status_t" type used throughout Kaleid and related + utilitary functions. + - types.h + Provides the elementary types (size_t, etc) used throught Kaleid. + + - convert.h + Contains the declaration of conversion utilities (e.g. itoa()) + It is included by string.h + + - memory.h + Contains the declaration of the mem*() family of utilities (e.g. memcpy()) + + - string.h + Contains the declaration of various string-related utilities (including the sprintf() family) + Includes convert.h diff --git a/src/kaleid/common/memory.h b/src/kaleid/common/memory.h index a877e1a..a628141 100644 --- a/src/kaleid/common/memory.h +++ b/src/kaleid/common/memory.h @@ -11,7 +11,7 @@ #define _KALCOMM_MEMORY_H #ifndef _KALCOMM_COMMON_H -#include "common/common.h" +# include "common/common.h" #endif #endif diff --git a/src/kaleid/common/status.h b/src/kaleid/common/status.h index 82387da..898c62a 100644 --- a/src/kaleid/common/status.h +++ b/src/kaleid/common/status.h @@ -11,7 +11,7 @@ #define _KALCOMM_STATUS_H #ifndef _KALCOMM_COMMON_H -#error "don't include common/types.h without common/common.h" +# error "don't include common/types.h without common/common.h" #endif #ifndef _OSK_SOURCE diff --git a/src/kaleid/common/string.h b/src/kaleid/common/string.h index 0f8542d..be51281 100644 --- a/src/kaleid/common/string.h +++ b/src/kaleid/common/string.h @@ -12,7 +12,11 @@ #define _KALCOMM_STRING_H #ifndef _KALCOMM_COMMON_H -#include "common/common.h" +# include "common/common.h" +#endif + +#ifndef _KALCOMM_CONVERT_H +# include "common/convert.h" #endif #ifndef _OSK_SOURCE diff --git a/src/kaleid/common/types.h b/src/kaleid/common/types.h index fb7d4ff..739efa9 100644 --- a/src/kaleid/common/types.h +++ b/src/kaleid/common/types.h @@ -12,7 +12,7 @@ #define _KALCOMM_TYPES_H #ifndef _KALCOMM_COMMON_H -#error "don't include common/types.h without common/common.h" +# error "don't include common/types.h without common/common.h" #endif #ifndef KEEP_KALCOMM_TYPES_MINIMAL diff --git a/src/kaleid/common/config.h b/src/kaleid/kernel/config.h similarity index 100% rename from src/kaleid/common/config.h rename to src/kaleid/kernel/config.h diff --git a/src/kaleid/common/config.h.in b/src/kaleid/kernel/config.h.in similarity index 100% rename from src/kaleid/common/config.h.in rename to src/kaleid/kernel/config.h.in diff --git a/src/kaleid/kernel/folder.desc b/src/kaleid/kernel/folder.desc index f035c37..1b37b3a 100644 --- a/src/kaleid/kernel/folder.desc +++ b/src/kaleid/kernel/folder.desc @@ -7,38 +7,30 @@ // Desc: Folder description - "kaleid/kernel" // //----------------------------------------------------------------------------// -This is the folder containing the source of Kaleid's kernel. +This folder contains the source of Kaleid's kernel component. -It contains the following files: +This contains the following files: - init.c The file containing the entry point of Kaleid, the kstart() function called from the bootloader (see ../../boot). -This folder also has the following subfolders -(for more information on a particular subfolder, see {name}/folder.desc) +This folder also has the following subfolders: - mm/ This folder contains all files related to memory management. - fs/ - This folder contains Kaleid's virtual filesystem, as well as one + This folder will contain Kaleid's virtual filesystem, as well as one subfolder for each FS supported by Kaleid (e.g. FAT filesystem). - io/ I/O folder. (XXX) - ps/ - This folder contains Kaleid's process manager and scheduler, as well as the + This folder will contain Kaleid's process manager and scheduler, as well as the implementation of the related syscalls and functions. - ex/ This folder contains the exec()-related functions and syscalls, as well as one subfolder per executable format supported by Kaleid (e.g. ELF executable) - - se/ - Security folder. (XXX) - - - sys/ - Syscall folder. (XXX) - - diff --git a/src/kaleid/kernel/io/terminal.c b/src/kaleid/kernel/io/terminal.c index 503dfcd..0fd46ac 100644 --- a/src/kaleid/kernel/io/terminal.c +++ b/src/kaleid/kernel/io/terminal.c @@ -167,7 +167,7 @@ status_t kterm_putch(struct kterm *kt, char ch) // -// Print string on kterminal +// Print string on terminal // status_t kterm_print(struct kterm *kt, const char *str) { diff --git a/src/kaleid/kernel/mm/malloc.h b/src/kaleid/kernel/mm/malloc.h index 2669121..9d63aba 100644 --- a/src/kaleid/kernel/mm/malloc.h +++ b/src/kaleid/kernel/mm/malloc.h @@ -5,6 +5,7 @@ // NeoX // // // // Desc: Memory allocation routines // +// Only exists to trigger Neox // //----------------------------------------------------------------------------// #ifndef _KALKERN_MM_MALLOC_H diff --git a/src/kaleid/linux/test-common.c b/src/kaleid/linux/test-common.c index a1707c6..ee2df6f 100644 --- a/src/kaleid/linux/test-common.c +++ b/src/kaleid/linux/test-common.c @@ -33,6 +33,8 @@ int main(int argc, char *argv[]) #undef strcpy assert(strcmp(strcpy(test2, test1), _osk_strcpy(test3, test1)) == 0); + // XXX test itoa() and v?sn?printf() + // tests done printf("2\n"); diff --git a/src/project-tree.txt b/src/project-tree.txt index 7e342f8..f102785 100644 --- a/src/project-tree.txt +++ b/src/project-tree.txt @@ -7,9 +7,14 @@ // Desc: Project Tree // //----------------------------------------------------------------------------// -// XXX *not* up to date - src/ + | + x COPYING + x CONTACT + x ChangeLog + | + - Makefile + - kernel.ld | + boot/ | | @@ -22,7 +27,7 @@ src/ | - loader16.inc | - loader64.inc | | - | - types.h + | 0 | + kaleid/ | | @@ -30,31 +35,61 @@ src/ | | | | | x folder.desc | | | + | | - config.h + | | - config.h.in + | | | | | - init.c | | - init.h | | | | | + io/ - | | | - | | - ports.c - | | - ports.h - | | - terminal.c - | | - terminal.h + | | | | + | | | - ports.c + | | | - ports.h + | | | | + | | | - terminal.c + | | | - terminal.h + | | | | + | | | 0 + | | | + | | + ke/ + | | | | + | | | - panic.c + | | | - panic.h + | | | | + | | | 0 + | | | + | | 0 | | | + common/ - | | - | x folder.desc - | | - | - assert.h - | - atomic.h - | - common.h - | - config.h - | - config.h.in - | - status.h - | - string.h - | - types.h - | | - | + lib/ - | | - | - string.c - | + | | | + | | x folder.desc + | | | + | | - common.h + | | - assert.h + | | - atomic.h + | | - status.h + | | - types.h + | | | + | | - string.h + | | - memory.h + | | - convert.h + | | | + | | + lib/ + | | | | + | | | - status.c + | | | | + | | | - string.c + | | | - memory.c + | | | - convert.c + | | | - sprintf.c + | | | | + | | | 0 + | | 0 + | | + | + linux/ + | | | + | | - test-common.c + | | | + | | 0 + | 0 0