summaryrefslogtreecommitdiff
path: root/Kernel/TTY
AgeCommit message (Collapse)Author
2020-03-26Kernel: Make ^W and ^U actually erase charactersAndreas Kling
This is quite hackish but it makes using the js REPL a lot nicer. :^)
2020-02-27SlavePTY: Use dbg() instead of dbgprintf()Liav A
2020-02-27MasterPTY: Use dbg() instead of dbgprintf()Liav A
2020-02-27PTYMultiplexer: Use dbg() instead of dbgprintf()Liav A
2020-02-27VirtualConsole: Use dbg() instead of dbgprintf()Liav A
2020-02-27TTY: Use dbg() instead of dbgprintf()Liav A
2020-02-26Kernel: Disallow assigning a TTY to an arbitrary process group IDAndreas Kling
It was possible to send signals to processes that you were normally not allowed to send signals to, by calling ioctl(tty, TIOCSPGRP, targetpid) and then generating one of the TTY-related signals on the calling process's TTY (e.g by pressing ^C, ^Z, etc.)
2020-02-20AK: Use size_t for CircularQueue and CircularDequeAndreas Kling
2020-02-18TTY: Reset VGA start row when setting graphical TTYJesse Buhagiar
This was causing the screen (on a real machine) to be split in half.
2020-02-17Kernel: Replace "current" with Thread::current and Process::currentAndreas Kling
Suggested by Sergey. The currently running Thread and Process are now Thread::current and Process::current respectively. :^)
2020-02-16Kernel: Move all code into the Kernel namespaceAndreas Kling
2020-02-09Kernel: Apply changes to use LibBareMetal definitionsLiav A
2020-01-28Kernel: Tweak some include statementsAndreas Kling
2020-01-25Kernel: Unbreak canonical mode TTY erase after LibVT changesAndreas Kling
Now that LibVT's backspace character (8) is non-destructive, the kernel line editing code has to take care of erasing manually.
2020-01-20Kernel: Make DoubleBuffer use a KBuffer instead of kmalloc()ingAndreas Kling
Background: DoubleBuffer is a handy buffer class in the kernel that allows you to keep writing to it from the "outside" while the "inside" reads from it. It's used for things like LocalSocket and TTY's. Internally, it has a read buffer and a write buffer, but the two will swap places when the read buffer is exhausted (by reading from it.) Before this patch, it was internally implemented as two Vector<u8> that we would swap between when the reader side had exhausted the data in the read buffer. Now instead we preallocate a large KBuffer (64KB*2) on DoubleBuffer construction and use that throughout its lifetime. This removes all the kmalloc heap traffic caused by DoubleBuffers :^)
2020-01-18Kernel: Move setting file flags and r/w mode to VFS::open()Sergey Bugaev
Previously, VFS::open() would only use the passed flags for permission checking purposes, and Process::sys$open() would set them on the created FileDescription explicitly. Now, they should be set by VFS::open() on any files being opened, including files that the kernel opens internally. This also lets us get rid of the explicit check for whether or not the returned FileDescription was a preopen fd, and in fact, fixes a bug where a read-only preopen fd without any other flags would be considered freshly opened (due to O_RDONLY being indistinguishable from 0) and granted a new set of flags.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-17Kernel: Move kernel above the 3GB virtual address markAndreas Kling
The kernel and its static data structures are no longer identity-mapped in the bottom 8MB of the address space, but instead move above 3GB. The first 8MB above 3GB are pseudo-identity-mapped to the bottom 8MB of the physical address space. But things don't have to stay this way! Thanks to Jesse who made an earlier attempt at this, it was really easy to get device drivers working once the page tables were in place! :^) Fixes #734.
2020-01-12Kernel: Require "tty" for ioctl() on TTY and MasterPTYAndreas Kling
SystemServer now pledges "tty" since it's used when spawning services.
2020-01-12Kernel: Put termios debug spam behind TTY_DEBUGAndreas Kling
2020-01-04Kernel: File::open() should apply r/w mode from the provided optionsAndreas Kling
This has been a FIXME for a long time. We now apply the provided read/write permissions to the constructed FileDescription when opening a File object via File::open().
2019-12-20VirtualConsole: use memmove for an overlapping copyjoshua stein
2019-12-09Kernel: Give PTY's *actually* unique major ID'sAndreas Kling
Okay, one "dunce hat" point for me. The new PTY majors conflicted with PATAChannel. Now they are 200 for master and 201 for slave, not used by anything else.. I hope!
2019-12-09TTY: Change the MasterPTY device major to not conflict with /dev/psauxAndreas Kling
The 1st master pseudoterminal had the same device ID as /dev/psaux which was caught by an assertion in Device VFS registration. This would cause us to overwrite the PS/2 mouse device registration which was definitely not good.
2019-11-27Kernel: Demangle userspace ELF symbols in backtracesAndreas Kling
Turns out we can use abi::__cxa_demangle() for this, and all we need to provide is sprintf(), realloc() and free(), so this patch exposes them. We now have fully demangled C++ backtraces :^)
2019-11-23Revert "Kernel: Move Kernel mapping to 0xc0000000"Andreas Kling
This reverts commit bd33c6627394b2166e1419965dd3b2d2dc0c401f. This broke the network card drivers, since they depended on kmalloc addresses being identity-mapped.
2019-11-22Kernel: Move Kernel mapping to 0xc0000000Jesse Buhagiar
The kernel is now no longer identity mapped to the bottom 8MiB of memory, and is now mapped at the higher address of `0xc0000000`. The lower ~1MiB of memory (from GRUB's mmap), however is still identity mapped to provide an easy way for the kernel to get physical pages for things such as DMA etc. These could later be mapped to the higher address too, as I'm not too sure how to go about doing this elegantly without a lot of address subtractions.
2019-11-06AK: Remove unused AK::not_implemented()Andreas Kling
Whatever this was supposed to be, it was ironically... not implemented.
2019-11-04Kernel: Make File's can_read/can_write take a const FileDescription&Andreas Kling
Asking a File if we could possibly read or write it will never mutate the asking FileDescription&, so it should be const.
2019-11-02TTY: Don't flush input on every characterAndreas Kling
Oops, we had a little mistake here. We were flushing whenever !NOFLSH, not just when generating a signal. This broke arrow keys in the terminal (you would only get A/B/C/D when pressing arrow keys, instead of the full escape sequence.)
2019-11-01TTY: Flush input on signal character.Drew Stratford
We now flush the input when we recieve a signal character. This can be disabled using the newly implemented NOFLSH attribute.
2019-10-30TTY: Properly implement echo in VirtualConsole.Drew Stratford
VirtualConsole::echo now actually echoes characters instead of doing nothing.
2019-10-24TTY: MasterPTY should fail to ioctl() if slave is goneAndreas Kling
Just fail with EIO in that case.
2019-10-24TTY: Forward TIOCGPGRP from MasterPTY to SlavePTYAndreas Kling
This makes tcgetpgrp() on a master PTY return the PGID of the slave PTY which is probably what you are looking for. I'm not sure how correct or standardized this is, but it makes sense to me right now.
2019-10-20TTY: Implement Canonical mode and basic echoing.Drew Stratford
The TTY driver now respects the ICANON flag, enabling basic line editing like VKILL, VERASE, VEOF and VWERASE. Additionally, ICANON is now set by default. Basic echoing has can now be enabled via the ECHO flag, though more complicated echoing like ECHOCTL or ECHONL has not been implemented.
2019-10-18Revert "Kernel: Make DoubleBuffer use a KBuffer instead of kmalloc()ing"Andreas Kling
This reverts commit 1cca5142afbd76833deedfdb238230ac53424855. This appears to be causing intermittent triple-faults and I don't know why yet, so I'll just revert it to keep the tree in decent shape.
2019-10-18Kernel: Make DoubleBuffer use a KBuffer instead of kmalloc()ingAndreas Kling
Background: DoubleBuffer is a handy buffer class in the kernel that allows you to keep writing to it from the "outside" while the "inside" reads from it. It's used for things like LocalSocket and PTY's. Internally, it has a read buffer and a write buffer, but the two will swap places when the read buffer is exhausted (by reading from it.) Before this patch, it was internally implemented as two Vector<u8> that we would swap between when the reader side had exhausted the data in the read buffer. Now instead we preallocate a large KBuffer (64KB*2) on DoubleBuffer construction and use that throughout its lifetime. This removes all the kmalloc heap traffic caused by DoubleBuffers :^)
2019-10-18Kernel: VirtualConsole can use kmalloc_eternal() for permanent stuffAndreas Kling
Less pressure on kmalloc heap.
2019-10-18Kernel: Keep TTY names in character buffers instead of StringsAndreas Kling
Just going over some little unnecessary little kmalloc allocations.
2019-09-16Kernel: Move kmalloc() into a Kernel/Heap/ directoryAndreas Kling
2019-09-06AK: Rename <AK/AKString.h> to <AK/String.h>Andreas Kling
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
2019-08-23Kernel: Give each TTY 1 KB of input bufferAndreas Kling
This papers over an immediate issue where pseudoterminals would choke on more than 16 characters of pasted input in the GUI terminal. Longer-term we should find a more elegant solution than using a static size CircularQueue for this.
2019-08-23Kernel: Use IteratorDecision in Process::for_each_in_pgrp()Andreas Kling
2019-08-18Kernel: Disable VGA console in graphical modeConrad Pankoff
2019-08-17DevPtsFS: Do not assume there is one of itSergey Bugaev
Unfortunately, that also means it can no longer inherit from SynthFS.
2019-08-12Kernel: Use a CircularQueue for input rather than a DoubleBufferConrad Pankoff
TTY::emit is called from an IRQ handler, and is used to push input data into a buffer for later retrieval. Previously this was using DoubleBuffer, but that class wants to take a lock. Our lock code wants to make sure interrupts are enabled, but they're disabled while an IRQ handler is running. This made the kernel sad, but this CircularQueue cheers it up by avoiding the lock requirement completely.
2019-08-12VirtualConsole: Only consume data from key-down eventsConrad Pankoff
2019-08-12Kernel: Restore alt+n hijacking for virtual console switchingConrad Pankoff
2019-08-11Kernel: Customize absolute_path() for more file typesSergey Bugaev
2019-08-11FileDescription: Disallow construction with a null FileAndreas Kling
It's not valid for a FileDescription to not have a file, so let's disallow it by taking a File& (or FIFO&) in the constructor.