From fdcf18e988bfaec933380c59e21ce57c6a4c810c Mon Sep 17 00:00:00 2001 From: Julian Barathieu Date: Tue, 25 Dec 2018 19:40:32 +0100 Subject: [PATCH] Cleaned up some things --- src/kaleid/common/lib/convert.c | 2 +- src/kaleid/common/lib/sprintf.c | 10 ++-------- src/kaleid/kernel/mm/malloc.c | 12 ++++++++++++ src/kaleid/kernel/mm/malloc.h | 16 ++++++++++++++++ src/kaleid/linux/test-common.c | 1 - src/making.sh | 0 src/project-tree.txt | 2 ++ src/script.sh | 4 ---- 8 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 src/kaleid/kernel/mm/malloc.c create mode 100644 src/kaleid/kernel/mm/malloc.h delete mode 100644 src/making.sh delete mode 100644 src/script.sh diff --git a/src/kaleid/common/lib/convert.c b/src/kaleid/common/lib/convert.c index 2731900..0f76565 100644 --- a/src/kaleid/common/lib/convert.c +++ b/src/kaleid/common/lib/convert.c @@ -37,7 +37,7 @@ char *itoa(int i, char *str, int base) *str++ = '0'; } - // compute digits... in reverse order (XXX?) + // compute digits... in reverse order while (i > 0) { *str++ = digits[i % base]; i /= base; diff --git a/src/kaleid/common/lib/sprintf.c b/src/kaleid/common/lib/sprintf.c index 1785a01..e26ded9 100644 --- a/src/kaleid/common/lib/sprintf.c +++ b/src/kaleid/common/lib/sprintf.c @@ -24,17 +24,14 @@ int sprintf(char *str, const char *fmt, ...) return ret; } -// -// Format str according to fmt, using the va_list ap -// int vsprintf(char *str, const char *fmt, va_list ap) { return vsnprintf(str, SIZE_T_MAX, fmt, ap); } // -// sprintf() but with a size limit: no more than n bytes are written in str -// XXX null termination behavior? +// (v)sprintf() but with a size limit: no more than n bytes are written in str +// XXX null termination behavior? // int snprintf(char *str, size_t n, const char *fmt, ...) { @@ -48,9 +45,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...) return ret; } -// -// snprintf() but arguments -// int vsnprintf(char *str, size_t n, const char *fmt, va_list ap) { int ret = 0; diff --git a/src/kaleid/kernel/mm/malloc.c b/src/kaleid/kernel/mm/malloc.c new file mode 100644 index 0000000..5c62036 --- /dev/null +++ b/src/kaleid/kernel/mm/malloc.c @@ -0,0 +1,12 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Authors: spectral` // +// NeoX // +// // +// Desc: Memory allocation routines // +// Only exists to trigger Neox // +//----------------------------------------------------------------------------// + +#include "kernel/mm/malloc.h" + diff --git a/src/kaleid/kernel/mm/malloc.h b/src/kaleid/kernel/mm/malloc.h new file mode 100644 index 0000000..2669121 --- /dev/null +++ b/src/kaleid/kernel/mm/malloc.h @@ -0,0 +1,16 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Authors: spectral` // +// NeoX // +// // +// Desc: Memory allocation routines // +//----------------------------------------------------------------------------// + +#ifndef _KALKERN_MM_MALLOC_H +#define _KALKERN_MM_MALLOC_H + +#include "common/common.h" + +#endif + diff --git a/src/kaleid/linux/test-common.c b/src/kaleid/linux/test-common.c index a8c746e..a1707c6 100644 --- a/src/kaleid/linux/test-common.c +++ b/src/kaleid/linux/test-common.c @@ -33,7 +33,6 @@ int main(int argc, char *argv[]) #undef strcpy assert(strcmp(strcpy(test2, test1), _osk_strcpy(test3, test1)) == 0); - // tests done printf("2\n"); diff --git a/src/making.sh b/src/making.sh deleted file mode 100644 index e69de29..0000000 diff --git a/src/project-tree.txt b/src/project-tree.txt index 1304d6a..7e342f8 100644 --- a/src/project-tree.txt +++ b/src/project-tree.txt @@ -7,6 +7,8 @@ // Desc: Project Tree // //----------------------------------------------------------------------------// +// XXX *not* up to date + src/ | + boot/ diff --git a/src/script.sh b/src/script.sh deleted file mode 100644 index 1ef10e1..0000000 --- a/src/script.sh +++ /dev/null @@ -1,4 +0,0 @@ -make -cp ../bin/bootloader.bin "~/Documents/GNU OSK/bin/bootloader.bin" -qemu-system-x86_64 -hda "~/Documents/GNU OSK/bin/bootloader.bin" -qemu-system-i386 -hda "~/Documents/GNU OSK/bin/bootloader.bin"