summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/tty/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/i386/tty/tty.c')
-rw-r--r--src/kernel/arch/i386/tty/tty.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/kernel/arch/i386/tty/tty.c b/src/kernel/arch/i386/tty/tty.c
index 5a65221..f3fecf3 100644
--- a/src/kernel/arch/i386/tty/tty.c
+++ b/src/kernel/arch/i386/tty/tty.c
@@ -1,3 +1,5 @@
+#include <kernel/arch/i386/interrupts/irq.h>
+#include <kernel/arch/i386/tty/keyboard.h>
#include <kernel/arch/i386/tty/serial.h>
#include <kernel/arch/i386/tty/vga.h>
#include <kernel/arch/io.h>
@@ -12,8 +14,13 @@ void tty_init(void) {
}
void tty_read(char *buf, size_t len) {
- for (size_t i = 0; i < len; i++)
- buf[i] = serial_read();
+ irq_interrupt_flag(true);
+ for (size_t i = 0; i < len; i++) {
+ for (;;) {
+ if (serial_poll_read(&buf[i])) break;
+ if (keyboard_poll_read(&buf[i])) break;
+ }
+ }
}
void tty_write(const char *buf, size_t len) {