From 307eaac66d378c1f6150519123ec1204277464d9 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sun, 26 Aug 2018 13:29:33 +1000 Subject: Updated the style of the code in lib/string.c to conform to the rest of the project. Added the system call 'sys_panic' as well as the corresponding library function panic() whose prototype is defined in unistd.h. This is to allow userspace programs to deliberately crash the kernel for the purpose of debugging. Added the element 'write' as a function pointer in the tty_struct structure. The purpose of this function pointer is to provide a means for the TTY subsystem to notify the device driver of any newly added data to the write queue. Added the tty_write() function to the TTY subsystem. This function will copy data provided by the user into the specified TTY device's write queue, blocking if the queue's buffer is full. tty_write() will then call the driver's write() function to notify it of new data. Added the rsint_tx() function to the serial driver to handle transmit interrupts by re-supplying the UART's transmit FIFO. --- include/kernel/sys.h | 8 +++++--- include/kernel/tty.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'include/kernel') diff --git a/include/kernel/sys.h b/include/kernel/sys.h index 2cefd09..e5275cf 100644 --- a/include/kernel/sys.h +++ b/include/kernel/sys.h @@ -9,8 +9,10 @@ extern int sys_alarm(void); extern int sys_pause(void); extern int sys_ctty(void); extern int sys_read(void); +extern int sys_write(void); extern int sys_kill(void); extern int sys_dummy(void); +extern int sys_panic(void); syscall_t call_table[256] = { [0] = &sys_puts, @@ -22,9 +24,9 @@ syscall_t call_table[256] = { [6] = &sys_pause, [7] = &sys_ctty, [8] = &sys_read, - [9] = &sys_kill, - [10] = &sys_dummy, - [11] = &sys_dummy, + [9] = &sys_write, + [10] = &sys_kill, + [11] = &sys_panic, [12] = &sys_dummy, [13] = &sys_dummy, [14] = &sys_dummy, diff --git a/include/kernel/tty.h b/include/kernel/tty.h index b3f3012..7c0fc6e 100644 --- a/include/kernel/tty.h +++ b/include/kernel/tty.h @@ -15,11 +15,13 @@ struct tty_queue { struct tty_struct { void (*init) (void); + void (*write) (void); struct tty_queue rqueue; struct tty_queue wqueue; }; ssize_t tty_read(unsigned, void*, size_t); +ssize_t tty_write(unsigned, void*, size_t); void tty_init(void); -- cgit v1.3