diff options
author | Marvin Borner | 2019-12-08 12:27:00 +0100 |
---|---|---|
committer | Marvin Borner | 2019-12-08 12:27:00 +0100 |
commit | e3c982ee44cff38bd764fbb6ab94972cf868a10a (patch) | |
tree | 755ed2716a4a3fb6caf04abaef00a784297692fe /src/kernel/syscall | |
parent | d94b024b73aeca06de417e0fd3c502495312a8b2 (diff) |
Working text input!
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r-- | src/kernel/syscall/actions/sys_read.c | 23 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_write.c | 5 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.h | 4 |
3 files changed, 13 insertions, 19 deletions
diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c index 761eec7..673d2d9 100644 --- a/src/kernel/syscall/actions/sys_read.c +++ b/src/kernel/syscall/actions/sys_read.c @@ -1,21 +1,16 @@ -#include <stdint-gcc.h> +#include <stdint.h> #include <kernel/lib/stdio.h> -#include <kernel/lib/string.h> -#include <kernel/io/io.h> #include <kernel/input/input.h> -#include <kernel/timer/timer.h> +#include <kernel/lib/lib.h> +#include <kernel/lib/string.h> -uint32_t sys_read() +uint32_t sys_read(char *buf) { - serial_write("CALL\n"); - keyboard_clear_buffer(); - while (keyboard_buffer[strlen(keyboard_buffer) - 1] != '\n') { - { - timer_wait(1); // IDK why? - } + keyboard_char_buffer = 0; + while (keyboard_char_buffer != '\n') { + getch(); } - serial_write(keyboard_buffer); - serial_write("\n"); - return (uint32_t) keyboard_buffer; + memcpy(buf, keyboard_buffer, strlen(keyboard_buffer)); + return strlen(buf); }
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_write.c b/src/kernel/syscall/actions/sys_write.c index aef2b2b..e0db9b0 100644 --- a/src/kernel/syscall/actions/sys_write.c +++ b/src/kernel/syscall/actions/sys_write.c @@ -3,9 +3,8 @@ #include <kernel/lib/string.h> #include <kernel/io/io.h> -uint32_t sys_write(unsigned int buf) +uint32_t sys_write(char *buf) { - serial_put(((char *) buf)[0]); - printf((const char *) buf); + printf(buf); return strlen((const char *) buf); }
\ No newline at end of file diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h index 8ed532d..f441cf1 100644 --- a/src/kernel/syscall/syscall.h +++ b/src/kernel/syscall/syscall.h @@ -5,8 +5,8 @@ extern void idt_syscall(); void syscalls_install(); -uint32_t sys_write(unsigned int buf); +uint32_t sys_write(char *buf); -uint32_t sys_read(); +uint32_t sys_read(char *buf); #endif
\ No newline at end of file |