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. --- kernel/rs.s | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'kernel/rs.s') diff --git a/kernel/rs.s b/kernel/rs.s index 9f3d4a6..69d31ae 100644 --- a/kernel/rs.s +++ b/kernel/rs.s @@ -1,7 +1,20 @@ global rs_isr -extern rs_handler +extern rsint_rx +extern rsint_tx extern rsputs +%define RSBASE 0x3F8 + +%define RSDATA RSBASE +%define RSINTEN (RSBASE + 1) +%define RSFIFOC (RSBASE + 2) +%define RSINTID (RSBASE + 2) +%define RSLINEC (RSBASE + 3) +%define RSMODEMC (RSBASE + 4) +%define RSLINES (RSBASE + 5) +%define RSMODEMS (RSBASE + 6) +%define RSSCRATCH (RSBASE + 7) + rs_isr: pusha mov ax, ds @@ -12,7 +25,24 @@ rs_isr: mov fs, ax mov gs, ax - call rs_handler + mov dx, RSINTID + in al, dx + test al, 1 + jnz .skip + and al, 0x0E + cmp al, 0x04 + je .rx + cmp al, 0x0C + je .rx + cmp al, 0x02 + je .tx + jmp .skip +.tx: + call rsint_tx + jmp .skip +.rx: + call rsint_rx +.skip: mov al, 0x20 out 0x20, al -- cgit v1.3