summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/tty/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/amd64/tty/tty.c')
-rw-r--r--src/kernel/arch/amd64/tty/tty.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/kernel/arch/amd64/tty/tty.c b/src/kernel/arch/amd64/tty/tty.c
new file mode 100644
index 0000000..6593ef6
--- /dev/null
+++ b/src/kernel/arch/amd64/tty/tty.c
@@ -0,0 +1,26 @@
+#include <kernel/arch/generic.h>
+#include <kernel/arch/amd64/driver/serial.h>
+#include <kernel/arch/amd64/tty/tty.h>
+#include <shared/printf.h>
+
+void tty_init(void) {
+ vga_clear();
+ serial_preinit();
+
+ vga_write("\x03 ", 2); // cp437 heart
+ serial_write("<3 ", 3);
+}
+
+static void backend(void __attribute__((unused)) *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;
+}