kernel: syscall, console and keyboard fixes

This commit is contained in:
Matheus
2023-07-09 18:12:38 -03:00
parent 2398dd9b80
commit 4793f61708
4 changed files with 5 additions and 9 deletions
+1 -1
View File
@@ -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
+2 -3
View File
@@ -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)) {
+2 -2
View File
@@ -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;
-3
View File
@@ -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);