diff options
Diffstat (limited to 'src/kernel/lib')
-rw-r--r-- | src/kernel/lib/lib.h | 2 | ||||
-rw-r--r-- | src/kernel/lib/memory.c | 20 | ||||
-rw-r--r-- | src/kernel/lib/stdio.h | 4 | ||||
-rw-r--r-- | src/kernel/lib/stdio/getch.c | 4 | ||||
-rw-r--r-- | src/kernel/lib/stdio/putch.c (renamed from src/kernel/lib/stdio/writec.c) | 2 | ||||
-rw-r--r-- | src/kernel/lib/stdio/readline.c | 10 | ||||
-rw-r--r-- | src/kernel/lib/stdio/vprintf.c | 16 |
7 files changed, 12 insertions, 46 deletions
diff --git a/src/kernel/lib/lib.h b/src/kernel/lib/lib.h index 7ebae9a..b08904f 100644 --- a/src/kernel/lib/lib.h +++ b/src/kernel/lib/lib.h @@ -36,8 +36,6 @@ void memory_info_init(struct multiboot_tag_basic_meminfo *tag); void memory_mmap_init(struct multiboot_tag_mmap *tag); -int memory_init(uint32_t multiboot_address); - void memory_print(); uint32_t memory_get_all(); diff --git a/src/kernel/lib/memory.c b/src/kernel/lib/memory.c index 6aed060..30f75f9 100644 --- a/src/kernel/lib/memory.c +++ b/src/kernel/lib/memory.c @@ -96,24 +96,4 @@ void memory_mmap_init(struct multiboot_tag_mmap *tag) } } total = sum >> 10; // I want kb -} - -int memory_init(uint32_t multiboot_address) -{ - int ret = 0; - struct multiboot_tag *tag; - - for (tag = (struct multiboot_tag *)(multiboot_address + 8); - tag->type != MULTIBOOT_TAG_TYPE_END; - tag = (struct multiboot_tag *)((multiboot_uint8_t *)tag + ((tag->size + 7) & ~7))) { - if (tag->type == MULTIBOOT_TAG_TYPE_BASIC_MEMINFO) { - info("Got memory info"); - memory_info_init((struct multiboot_tag_basic_meminfo *)tag); - } else if (tag->type == MULTIBOOT_TAG_TYPE_MMAP) { - info("Got memory map"); - memory_mmap_init((struct multiboot_tag_mmap *)tag); - ret = 1; - } - } - return ret; }
\ No newline at end of file diff --git a/src/kernel/lib/stdio.h b/src/kernel/lib/stdio.h index 8668775..7dae60e 100644 --- a/src/kernel/lib/stdio.h +++ b/src/kernel/lib/stdio.h @@ -5,9 +5,7 @@ char getch(); -char *readline(); - -void writec(char c); +void putch(char c); void vprintf(const char *fmt, va_list args); diff --git a/src/kernel/lib/stdio/getch.c b/src/kernel/lib/stdio/getch.c index e806013..4f6ed39 100644 --- a/src/kernel/lib/stdio/getch.c +++ b/src/kernel/lib/stdio/getch.c @@ -1,11 +1,11 @@ #include <kernel/input/input.h> #include <kernel/timer/timer.h> +#include <kernel/system.h> char getch() { keyboard_char_buffer = 0; while (keyboard_char_buffer == 0) { - timer_wait(1); // IDK why! - } + }; return keyboard_char_buffer; }
\ No newline at end of file diff --git a/src/kernel/lib/stdio/writec.c b/src/kernel/lib/stdio/putch.c index 83b05de..f7e0248 100644 --- a/src/kernel/lib/stdio/writec.c +++ b/src/kernel/lib/stdio/putch.c @@ -1,6 +1,6 @@ #include <kernel/graphics/vesa.h> -void writec(char c) +void putch(char c) { vesa_draw_char(c); }
\ No newline at end of file diff --git a/src/kernel/lib/stdio/readline.c b/src/kernel/lib/stdio/readline.c deleted file mode 100644 index 1bda252..0000000 --- a/src/kernel/lib/stdio/readline.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <kernel/input/input.h> -#include <kernel/lib/string.h> - -char *readline() -{ - keyboard_clear_buffer(); - while (keyboard_buffer[strlen(keyboard_buffer) - 1] != '\n') { - } - return keyboard_buffer; -}
\ No newline at end of file diff --git a/src/kernel/lib/stdio/vprintf.c b/src/kernel/lib/stdio/vprintf.c index b9188c6..2431a48 100644 --- a/src/kernel/lib/stdio/vprintf.c +++ b/src/kernel/lib/stdio/vprintf.c @@ -5,10 +5,10 @@ #include <kernel/lib/stdlib.h> #include <kernel/memory/alloc.h> -void _writes(const char *data) +void _puts(const char *data) { for (size_t i = 0; i < strlen(data); i++) - writec(data[i]); + putch(data[i]); } void vprintf(const char *fmt, va_list args) @@ -20,7 +20,7 @@ void vprintf(const char *fmt, va_list args) for (; *fmt; fmt++) { if (readyToFormat) { if (*fmt == '%') { - writec('%'); + putch('%'); readyToFormat = 0; continue; } @@ -28,27 +28,27 @@ void vprintf(const char *fmt, va_list args) buff = *fmt; if (buff == 's') { const char *str = va_arg(args, const char *); - _writes(str); + _puts(str); readyToFormat = 0; } else if (buff == 'x') { char *p = htoa((uint32_t)va_arg(args, int)); - _writes(p); + _puts(p); kfree(p); readyToFormat = 0; } else if (buff == 'd') { char *p = itoa(va_arg(args, int)); - _writes(p); + _puts(p); kfree(p); readyToFormat = 0; } else if (buff == 'c') { - writec((char)va_arg(args, int)); + putch((char)va_arg(args, int)); readyToFormat = 0; } } else { if (*fmt == '%') readyToFormat = 1; else - writec(*fmt); + putch(*fmt); } } }
\ No newline at end of file |