summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/tty/tty.c
diff options
context:
space:
mode:
authordzwdz2022-04-14 12:19:51 +0200
committerdzwdz2022-04-14 12:19:51 +0200
commit2eead2f6eab2aa1fbc727ce28d9fa9a8e90a1eec (patch)
treed4bb0ae50e5f612a4fae67763414f72ea1a85b8a /src/kernel/arch/i386/tty/tty.c
parentdcb2ce6337f54a9821e3971976a07e767846e3c1 (diff)
kernel: port init's `printf` implementation
Diffstat (limited to 'src/kernel/arch/i386/tty/tty.c')
-rw-r--r--src/kernel/arch/i386/tty/tty.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/kernel/arch/i386/tty/tty.c b/src/kernel/arch/i386/tty/tty.c
index fa3ce72..d4a97fb 100644
--- a/src/kernel/arch/i386/tty/tty.c
+++ b/src/kernel/arch/i386/tty/tty.c
@@ -1,17 +1,26 @@
+#include <kernel/arch/generic.h>
#include <kernel/arch/i386/driver/serial.h>
#include <kernel/arch/i386/tty/vga.h>
-#include <kernel/arch/io.h>
+#include <shared/printf.h>
void tty_init(void) {
vga_clear();
serial_init();
- // write hearts
- vga_write("\x03 ", 2);
+ vga_write("\x03 ", 2); // cp437 heart
serial_write("<3 ", 3);
}
-void tty_write(const char *buf, size_t len) {
+static void backend(void *arg, const char *buf, size_t len) {
vga_write(buf, len);
serial_write(buf, len);
}
+
+int kprintf(const char *fmt, ...) {
+ int ret;
+ va_list argp;
+ va_start(argp, fmt);
+ ret = __printf_internal(fmt, argp, backend, NULL);
+ va_end(argp);
+ return ret;
+}