From 4793f617084aee477536778a108d4e76dfad9296 Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 9 Jul 2023 18:12:38 -0300 Subject: [PATCH] kernel: syscall, console and keyboard fixes --- kernel-src/arch/x86-64/syscalllog.c | 2 +- kernel-src/io/console.c | 5 ++--- kernel-src/io/keyboard.c | 4 ++-- kernel-src/sys/syscalls/readlinkat.c | 3 --- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/kernel-src/arch/x86-64/syscalllog.c b/kernel-src/arch/x86-64/syscalllog.c index 8f072892..5d2f0a83 100644 --- a/kernel-src/arch/x86-64/syscalllog.c +++ b/kernel-src/arch/x86-64/syscalllog.c @@ -72,7 +72,7 @@ static char *args[] = { "fd %d", // isatty "dirfd %d pathname %s mode %d flags %d", // faccessat "dirfd %d pathname %d flags %d", // unlinkat - "fd %d request %lu argument %d", // ioctl + "fd %d request %lu argument %p", // ioctl "dirfd %d path %s mode %o", // mkdirat "clockid %d timespec %p", // clockget "olddirfd %d oldpath %s newdirfd %d oldpath %s flags %d type %d", // linkat diff --git a/kernel-src/io/console.c b/kernel-src/io/console.c index c0d70c5b..f5a25766 100644 --- a/kernel-src/io/console.c +++ b/kernel-src/io/console.c @@ -15,7 +15,7 @@ static mutex_t readmutex; static semaphore_t readsemaphore; static ringbuffer_t readbuffer; static thread_t *thread; -static termios_t termios; +static volatile termios_t termios; static pollheader_t pollheader; void console_write(char *str, size_t count) { @@ -65,8 +65,7 @@ static void consolethread() { if (packet.ascii == '\r' && (termios.c_iflag & ICRNL)) packet.ascii = '\n'; - - if (packet.ascii == '\n' && (termios.c_iflag & INLCR)) + else if (packet.ascii == '\n' && (termios.c_iflag & INLCR)) packet.ascii = '\r'; if (packet.flags & (KBPACKET_FLAGS_LEFTCTRL | KBPACKET_FLAGS_RIGHTCTRL)) { diff --git a/kernel-src/io/keyboard.c b/kernel-src/io/keyboard.c index f4424ecf..bf3ab4aa 100644 --- a/kernel-src/io/keyboard.c +++ b/kernel-src/io/keyboard.c @@ -9,11 +9,11 @@ #define BUFFER_SIZE (BUFFER_PACKET_CAPACITY * sizeof(kbpacket_t)) static char asciitable[] = { - 0, '\033', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\n', 0, '/', 0, 0, '\n', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, '\033', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\r', 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\r', 0, '/', 0, 0, '\r', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static char asciitableupper[] = { - 0, '\033', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '\b', '\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '\"', '~', 0, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\n', 0, '/', 0, 0, '\n', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, '\033', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '\b', '\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\r', 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '\"', '~', 0, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\r', 0, '/', 0, 0, '\r', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static int currentkbnum; diff --git a/kernel-src/sys/syscalls/readlinkat.c b/kernel-src/sys/syscalls/readlinkat.c index f992eebe..cf6f8ebd 100644 --- a/kernel-src/sys/syscalls/readlinkat.c +++ b/kernel-src/sys/syscalls/readlinkat.c @@ -29,8 +29,6 @@ syscallret_t syscall_readlinkat(context_t *, int dirfd, const char *upath, char if (ret.errno) goto cleanup; - printf("buffer: %p\n", buffer); - ret.errno = VOP_READLINK(node, &buffer, &_cpu()->thread->proc->cred); if (ret.errno) goto cleanup; @@ -43,7 +41,6 @@ syscallret_t syscall_readlinkat(context_t *, int dirfd, const char *upath, char ret.ret = copylen; cleanup: - printf("buffer (cl): %p\n", buffer); if (buffer) free(buffer);