aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/lib')
-rw-r--r--src/kernel/lib/memory.c6
-rw-r--r--src/kernel/lib/stdio.h4
-rw-r--r--src/kernel/lib/stdio/debug.c23
3 files changed, 18 insertions, 15 deletions
diff --git a/src/kernel/lib/memory.c b/src/kernel/lib/memory.c
index 4763ca0..3202691 100644
--- a/src/kernel/lib/memory.c
+++ b/src/kernel/lib/memory.c
@@ -40,10 +40,10 @@ multiboot_info_t *multiboot_header;
void memory_print()
{
if (multiboot_header->flags & MULTIBOOT_INFO_MEMORY) {
- serial_printf("Mem lower: 0x%x", multiboot_header->mem_lower);
- serial_printf("Mem upper: 0x%x", multiboot_header->mem_upper);
+ log("Mem lower: 0x%x", multiboot_header->mem_lower);
+ log("Mem upper: 0x%x", multiboot_header->mem_upper);
} else {
- serial_printf("No memory information available!");
+ log("No memory information available!");
}
}
diff --git a/src/kernel/lib/stdio.h b/src/kernel/lib/stdio.h
index e1d7b9a..6da0f37 100644
--- a/src/kernel/lib/stdio.h
+++ b/src/kernel/lib/stdio.h
@@ -13,6 +13,8 @@ void vprintf(const char *fmt, va_list args);
void printf(const char *fmt, ...);
+void serial_vprintf(const char *fmt, va_list args);
+
void serial_printf(const char *fmt, ...);
-#endif \ No newline at end of file
+#endif
diff --git a/src/kernel/lib/stdio/debug.c b/src/kernel/lib/stdio/debug.c
index b5e5094..68f0785 100644
--- a/src/kernel/lib/stdio/debug.c
+++ b/src/kernel/lib/stdio/debug.c
@@ -5,17 +5,14 @@
#include <kernel/io/io.h>
#include <kernel/memory/alloc.h>
-void _write_serial(const char *data)
+void serial_print(const char *data)
{
for (size_t i = 0; i < strlen(data); i++)
serial_put(data[i]);
}
-void serial_printf(const char *fmt, ...)
+void serial_vprintf(const char *fmt, va_list args)
{
- va_list args;
- va_start(args, fmt);
-
uint8_t readyToFormat = 0;
char buff = 0;
@@ -31,16 +28,16 @@ void serial_printf(const char *fmt, ...)
buff = *fmt;
if (buff == 's') {
const char *str = va_arg(args, const char *);
- _write_serial(str);
+ serial_print(str);
readyToFormat = 0;
} else if (buff == 'x') {
char *p = htoa((uint32_t)va_arg(args, int));
- _write_serial(p);
+ serial_print(p);
kfree(p);
readyToFormat = 0;
} else if (buff == 'd') {
char *p = itoa(va_arg(args, int));
- _write_serial(p);
+ serial_print(p);
kfree(p);
readyToFormat = 0;
} else if (buff == 'c') {
@@ -54,8 +51,12 @@ void serial_printf(const char *fmt, ...)
serial_put(*fmt);
}
}
+}
- serial_put('\n');
-
+void serial_printf(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ serial_vprintf(fmt, args);
va_end(args);
-} \ No newline at end of file
+}