summaryrefslogtreecommitdiff
path: root/Kernel/Console.cpp
AgeCommit message (Collapse)Author
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-17Kernel: Refactor storage stack with u64 as file operations offsetJean-Baptiste Boric
2021-02-19Kernel: Slap UNMAP_AFTER_INIT on a bunch more functionsAndreas Kling
We're now able to unmap 100 KiB of kernel text after init. :^)
2021-02-19Kernel: Slap UNMAP_AFTER_INIT on a whole bunch of functionsAndreas Kling
There's no real system here, I just added it to various functions that I don't believe we ever want to call after initialization has finished. With these changes, we're able to unmap 60 KiB of kernel text after init. :^)
2021-01-20Kernel+LibC: Turn errno codes into a strongly typed enumAndreas Kling
..and allow implicit creation of KResult and KResultOr from ErrnoCode. This means that kernel functions that return those types can finally do "return EINVAL;" and it will just work. There's a handful of functions that still deal with signed integers that should be converted to return KResults.
2020-09-25Meta+Kernel: Make clang-format-10 cleanBen Wiederhake
2020-09-13Kernel: Make copy_to/from_user safe and remove unnecessary checksTom
Since the CPU already does almost all necessary validation steps for us, we don't really need to attempt to do this. Doing it ourselves doesn't really work very reliably, because we'd have to account for other processors modifying virtual memory, and we'd have to account for e.g. pages not being able to be allocated due to insufficient resources. So change the copy_to/from_user (and associated helper functions) to use the new safe_memcpy, which will return whether it succeeded or not. The only manual validation step needed (which the CPU can't perform for us) is making sure the pointers provided by user mode aren't pointing to kernel mappings. To make it easier to read/write from/to either kernel or user mode data add the UserOrKernelBuffer helper class, which will internally either use copy_from/to_user or directly memcpy, or pass the data through directly using a temporary buffer on the stack. Last but not least we need to keep syscall params trivial as we need to copy them from/to user mode using copy_from/to_user.
2020-08-25Kernel: Switch singletons to use new Singleton classTom
MemoryManager cannot use the Singleton class because MemoryManager::initialize is called before the global constructors are run. That caused the Singleton to be re-initialized, causing it to create another MemoryManager instance. Fixes #3226
2020-08-22Revert "Kernel: Switch singletons to use new Singleton class"Andreas Kling
This reverts commit f48feae0b2a300992479abf0b2ded85e45ac6045.
2020-08-22Revert "Kernel: Move Singleton class to AK"Andreas Kling
This reverts commit f0906250a181c831508a45434b9f645ff98f33e4.
2020-08-22Revert "AK: Get rid of make_singleton function"Andreas Kling
This reverts commit 5a98e329d157a2db8379e0c97c6bdc1328027843.
2020-08-22AK: Get rid of make_singleton functionTom
Just default the InitFunction template argument.
2020-08-22Kernel: Move Singleton class to AKTom
2020-08-21Kernel: Switch singletons to use new Singleton classTom
Fixes #3226
2020-08-04Kernel: Make File::write() and File::read() return KResultOr<size_t>Andreas Kling
Instead of returning a ssize_t where negative values mean error, we now return KResultOr<size_t> and use the error state to report errors exclusively.
2020-07-01Kernel: Protect Console with SpinLockTom
2020-05-27Kernel: Port VirtualConsole to LibVT :^)Sergey Bugaev
Unfortunately this drops the feature of preserving VGA buffer contents. Resolves https://github.com/SerenityOS/serenity/issues/2399
2020-05-16Kernel: Absorb LibBareMetal back into the kernelAndreas Kling
This was supposed to be the foundation for some kind of pre-kernel environment, but nobody is working on it right now, so let's move everything back into the kernel and remove all the confusion.
2020-02-09Kernel: Apply changes to use LibBareMetal definitionsLiav A
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.
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-03Kernel: Prevent kprintf() from asserting in Console::the() (#718)Nicolas Van Bossuyt
This triggered a stack overflow because ubsan can call kprintf() at any time, even before Console is initialized.
2019-07-03AK: Rename the common integer typedefs to make it obvious what they are.Andreas Kling
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
2019-06-07Kernel: Rename FileDescriptor to FileDescription.Andreas Kling
After reading a bunch of POSIX specs, I've learned that a file descriptor is the number that refers to a file description, not the description itself. So this patch renames FileDescriptor to FileDescription, and Process now has FileDescription* file_description(int fd).
2019-04-29Kernel: Have File virtuals take a FileDescriptor& rather than a Process&.Andreas Kling
This will allow us to implement different behaviors depending on the role of the descriptor a File is being accessed through.
2019-04-10Kernel: Remove two unneeded headers.Andreas Kling
2019-02-25Kernel: Make syscalls that take a buffer size use ssize_t instead of size_t.Andreas Kling
Dealing with the unsigned overflow propagation here just seems unreasonably error prone. Let's limit ourselves to 2GB buffer sizes instead.
2019-01-28Expose the kernel log buffer through /proc/dmesg.Andreas Kling
Also add a /bin/dmesg program for convenience.
2019-01-16Pass the process to CharacterDevice::read/write.Andreas Kling
This is much nicer than grabbing directly at 'current' inside a read().
2019-01-16Rename CharacterDevice::has_data_available_for_reading() -> can_read().Andreas Kling
2019-01-14Start refactoring the windowing system to use an event loop.Andreas Kling
Userspace programs can now open /dev/gui_events and read a stream of GUI_Event structs one at a time. I was stuck on a stupid problem where we'd reenter Scheduler::yield() due to having one of the has_data_available_for_reading() implementations using locks.
2018-12-03Yet more coding style fixes.Andreas Kling
2018-12-03More coding style changes.Andreas Kling
2018-11-12Add primitive FIFO and hook it up to sys$pipe().Andreas Kling
It's now possible to do this in bash: cat kernel.map | fgrep List This is very cool! :^)
2018-11-10Merge VGA into VirtualConsole.Andreas Kling
2018-10-30Fix bug where Console::the() was initialized too late.Andreas Kling
Yet another problem due to lack of BSS zeroing in the kernel loader...
2018-10-30Start working on virtual consoles/TTYs.Andreas Kling
This is a mess right now, but I'd rather commit as I go.
2018-10-30Basic support the backspace key.Andreas Kling
This doesn't mean we get any line editing just yet. But the keyboard device now recognizes the backspace key, and the console device knows what to do with the backspace characters.
2018-10-29Fix broken SpinLock.Andreas Kling
The SpinLock was all backwards and didn't actually work. Fixing it exposed how wrong most of the locking here is. I need to come up with a better granularity here.
2018-10-28Add save/unsave cursor escape sequences.Andreas Kling
Also added a little terminal test program called /bin/tst.
2018-10-28Add basic support for ANSI color escape sequences.Andreas Kling
2018-10-27Implement 'H' and 'J' escape sequences.Andreas Kling
2018-10-26Remove logspam in /dev/{full,null,zero} now that they work just fine.Andreas Kling
Also don't echo anything to console when putch'ing '\0'.
2018-10-25Implement a basic way for read() to block.Andreas Kling
FileHandle gets a hasDataAvailableForRead() getter. If this returns true in sys$read(), the task will block(BlockedRead) + yield. The fd blocked on is stored in Task::m_fdBlockedOnRead. The scheduler then looks at the state of that fd during the unblock phase. This makes "sh" restful. :^) There's still some problem with the kernel not surviving the colonel task getting scheduled. I need to figure that out and fix it.
2018-10-23Remove remains of the old "panel" task.Andreas Kling
...and grow the console by 1 row! :^)
2018-10-23Also send console output to port 0xe9 (bochs console.)Andreas Kling
This is very handy for debugging.
2018-10-22A lot of hacking:Andreas Kling
- More work on funneling console output through Console. - init() now breaks off into a separate task ASAP. - ..this leaves the "colonel" task as a simple hlt idle loop. - Mask all IRQs on startup (except IRQ2 for slave passthru) - Fix underallocation bug in Task::allocateRegion(). - Remember how many times each Task has been scheduled. The panel and scheduling banner are disabled until I get things working nicely in the (brave) new Console world.
2018-10-21Have Console::write() directly call vga_putch.Andreas Kling
2018-10-21Add a Console device and start refactoring screen output.Andreas Kling