summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2023-03-19Kernel/Graphics: Use longer timeout settings in VirtIO GPU commandsLiav A
It appeared that we sometimes failed to invoke synchronous commands on the GPU. To temporarily fix this, wait 10 milliseconds for commands to complete before failing.
2023-03-19Kernel: Simplify VirtIOGPU attach_physical_range_to_framebuffer methodLiav A
According to the specification, modesetting can be invoked with no need for flushing the framebuffer nor with DMA to transfer the framebuffer rendering.
2023-03-19Kernel/VirtIO: Ignore the VIRTIO_PCI_CAP_PCI_CFG configuration typeLiav A
This configuration exposes a suboptimal mechanism to access other VirtIO device configurations. It is also the only configuration to use a zero length for a configuration structure, and specify a valid BAR which triggered a kernel panic when attaching a virtio-gpu-pci device before 95b15e49010299902abd2aa65bcc71e4158b7326 was applied. The real solution for that problem is to ignore this configuration type because we never actually use it. It means that we can VERIFY that all other configuration types have a valid length, as being expected.
2023-03-16Kernel: Refactor AHCIController to propagate more errorsJulian Offenhäuser
Before, the mapping of our HBA region would be done in the constructor. Since this can fail, I moved it into initialize(). Additionally, we now use the TypedMapping helper for mapping the HBA instead of doing it manually. This actually uncovered a bug where we would ignore any possible offset into the page we were mapping, which caused us to miss the mapped registers entirely.
2023-03-16Kernel: Allow AHCIController::initialize() to failJulian Offenhäuser
If we fail to initialize an AHCI controller, we now skip adding it to the list of storage controllers in StorageManagement.
2023-03-16Kernel: Propagate errors in StorageController reset() and shutdown()Julian Offenhäuser
These used to signal an error with a boolean return type. We now return a sensible errno instead.
2023-03-15Kernel: Merge {get,set}_process_name syscalls to the prctl syscallLiav A
It makes much more sense to have these actions being performed via the prctl syscall, as they both require 2 plain arguments to be passed to the syscall layer, and in contrast to most syscalls, we don't get in these removed syscalls an automatic representation of Userspace<T>, but two FlatPtr(s) to perform casting on them in the prctl syscall which is suited to what has been done in the removed syscalls. Also, it makes sense to have these actions in the prctl syscall, because they are strongly related to the process control concept of the prctl syscall.
2023-03-15Kernel/Ramdisk: Propagate error during Ramdisk initializePankaj Raghav
Use the same pattern for Ramdisk similar to other storage devices during device initialization. This will propagate errors if the Ramdisk fails to initialize.
2023-03-15Kernel/Storage: Use NonnullRefPtr for storage controllersPankaj Raghav
Storage controllers are initialized during init and are never modified. NonnullRefPtr can be safely used instead of the NonnullLockRefPtr. This also fixes one of the UB issue that was there when using an NVMe device because of NonnullLockRefPtr. We can add proper locking when we need to modify the storage controllers after init.
2023-03-13AK: Rename Stream::write_entire_buffer to Stream::write_until_depletedTim Schumacher
No functional changes.
2023-03-13Kernel: Don't include Kernel/Arch/RegisterState from userspaceAndrew Kaster
Any userspace cpp file that included <syscall.h> would end up with a large glob of Kernel headers included, all the way down to Kernel/Arch/x86_64/CPU.h and friends. Only the kernel needs RegisterState, so hide it from userspace.
2023-03-12Kernel: Make the Jails' internal design a lot more saneLiav A
This is done with 2 major steps: 1. Remove JailManagement singleton and use a structure that resembles what we have with the Process object. This is required later for the second step in this commit, but on its own, is a major change that removes this clunky singleton that had no real usage by itself. 2. Use IntrusiveLists to keep references to Process objects in the same Jail so it will be much more straightforward to iterate on this kind of objects when needed. Previously we locked the entire Process list and we did a simple pointer comparison to check if the checked Process we iterate on is in the same Jail or not, which required taking multiple Spinlocks in a very clumsy and heavyweight way.
2023-03-11Kernel/Storage+Base: Fix boot_device_addressing document for NVMePankaj Raghav
The LUN.target_id parameter points to a NVMe Namespace which starts from 1 and not 0. Fix the document to reflect the same while addressing a nvme device in the boot parameters
2023-03-11Kernel: Add non standard value to sys$sysconfFabian Dellwing
Add `_SC_PHYS_PAGES` to sys$sysconf syscall. This value is needed for a port I'm working on.
2023-03-11Kernel: Fix variable shadowing issue in PCIIDELegacyModeControllerJulian Offenhäuser
In this specific else case, primary_base_io_window would not be assigned in the outer scope, leading to a crash immediately after.
2023-03-10Kernel: Use RefPtr instead of LockRefPtr for File and subclassesAndreas Kling
This was mostly straightforward, as all the storage locations are guarded by some related mutex. The use of old-school associated mutexes instead of MutexProtected is unfortunate, but the process to modernize such code is ongoing.
2023-03-09Kernel: Switch LockRefPtr<Inode> to RefPtr<Inode>Andreas Kling
The main place where this is a little iffy is in RAMFS where inodes have a LockWeakPtr to their parent inode. I've left that as a LockWeakPtr for now.
2023-03-08Kernel: Add missing include that broke the AARCH64 buildMarco Cutecchia
2023-03-08Kernel: Fix mispellings of AARCH64 that broke the buildMarco Cutecchia
2023-03-08Kernel/Storage: Remove indication for possible future support of ATAPILiav A
There's no plan to support ATAPI in the foreseeable future. ATAPI is considered mostly as an extension to pass SCSI commands over ATA-link compatible channel (which could be a physical SATA or PATA). ATAPI is mostly used for controlling optical drives which are considered obsolete in 2023, and require an entire SCSI abstraction layer we don't exhibit with bypassing ioctls for sending specific SCSI commands in many control-flow sequences for actions being taken for such hardware. Therefore, let's make it clear we don't support ATAPI (SCSI over ATA) unless someone picks it up and proves otherwise that this can be done cleanly and also in a relevant way to our project.
2023-03-08Kernel: Remove ATAPI eject method from the AHCIPort classLiav A
We never actually used it. It never has been proved to work reliably, therefore it should be removed.
2023-03-08Kernel/VirtIO: Ignore Configurations that have length of zero bytesLiav A
These configurations are simply invalid. Ignoring those allow us to boot with the virtio-gpu-pci device (in addition to the already supported virtio-vga PCI device).
2023-03-07Kernel: Use non-locking {Nonnull,}RefPtr for OpenFileDescriptionAndreas Kling
This patch switches away from {Nonnull,}LockRefPtr to the non-locking smart pointers throughout the kernel. I've looked at the handful of places where these were being persisted and I don't see any race situations. Note that the process file descriptor table (Process::m_fds) was already guarded via MutexProtected.
2023-03-06Kernel: Remove two outdated FIXMEs about the file descriptor table mutexAndreas Kling
These functions cannot be called without already holding the relevant mutex these days, since m_fds is a MutexProtected object. :^)
2023-03-06AK+Kernel: Remove all the Nonnull*PtrVector classesAndreas Kling
2023-03-06Kernel: Stop using NonnullLockRefPtrVectorAndreas Kling
2023-03-06Everywhere: Remove NonnullOwnPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullOwnPtrVectorAndreas Kling
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06Everywhere: Remove NonnullRefPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullRefPtrVectorAndreas Kling
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-05Kernel: Move process coredump metadata modification to the prctl syscallLiav A
2023-03-05Kernel: Actually check Process unveil data when creating perfcore dumpLiav A
Before of this patch, we looked at the unveil data of the FinalizerTask, which naturally doesn't have any unveil restrictions, therefore allowing an unveil bypass for a process that enabled performance coredumps. To ensure we always check the dumped process unveil data, an option to pass a Process& has been added to a couple of methods in the class of VirtualFileSystem.
2023-03-05Kernel+Userland: Add support for using the PCSpeaker with various tonesLiav A
2023-03-01Kernel: Move TYPEDEF_* TTY macros to API/ttydefaults.h fileLiav A
This allows us to get rid of an include to LibC/sys/ttydefaults.h in the Kernel TTY implementation. Also, move ttydefchars static const struct to another file called Kernel/API/ttydefaultschars.h, so it could be used too in the Kernel TTY implementation without the need to include anything from LibC.
2023-03-01Kernel+LibC: Move the FD_SETSIZE declaration to API/POSIX/select.h fileLiav A
2023-03-01Kernel: Remove includes to LibC stdarg definitionsLiav A
We don't actually need the va_list and other stdarg definitions in the kernel, because we actually don't use the "pure" printf interface in any kernel code at all, but we retain the snprintf declaration because the libstdc++ library still need it to be declared and extern'ed.
2023-03-01Kernel: Remove heuristics for detecting malformed malloc memory accessLiav A
I never saw these kind of messages in any debug session I had, and it helps us to remove an include to LibC/mallocdefs.h file.
2023-02-25Kernel: Mark sys$prctl() as not needing the big lockLiav A
This syscall has sufficient locking and therefore it doesn't need the big lock being taken.
2023-02-24Kernel+Userland: Refine preventing syscall annotations of Regions optionLiav A
Instead of using a special case of the annotate_mapping syscall, let's introduce a new prctl option to disallow further annotations of Regions as new syscall Region(s).
2023-02-24Kernel: Do 2 validations in annotate_mapping syscall outside a spinlockLiav A
2023-02-24Kernel: Properly lock Process protected data in the prctl syscallLiav A
2023-02-24Kernel/FileSystem: Simplify the ProcFS significantlyLiav A
Since the ProcFS doesn't hold many global objects within it, the need for a fully-structured design of backing components and a registry like with the SysFS is no longer true. To acommodate this, let's remove all backing store and components of the ProcFS, so now it resembles what we had in the early days of ProcFS in the project - a mostly-static filesystem, with very small amount of kmalloc allocations needed. We still use the inode index mechanism to understand the role of each inode, but this is done in a much "static"ier way than before.
2023-02-24Kernel: Fix typo proccess => process in a name of Process methodLiav A
2023-02-24AK+Kernel: Add includes before removing Kernel/ProcessExposed.hLiav A
Apparently without this file, we won't be able to compile due to missing includes to TimeManagement and KBufferBuilder.
2023-02-24Kernel+Userland: Unify declarations for KCOV in Kernel/API/kcov.hLiav A
2023-02-24Kernel+Userland: Move prctl numbers header file to Kernel/API directoryLiav A
2023-02-23Kernel: Prevent out-of-bounds read/write in VirtIO GPU3DDevice::ioctlLiav A
Before doing a check if offset_in_region + num_bytes of the transfer descriptor are together more than NUM_TRANSFER_REGION_PAGES * PAGE_SIZE, check that addition of both of these parameters will not simply overflow which could lead to out-of-bounds read/write. Fixes #17518.
2023-02-21Kernel: Support more clocks in sys$clock_getres()Humberto Alves
Support all the available clocks in clock_getres(). Also, fix this function to use the actual ticks per second value, not the constant `_SC_CLK_TCK` (which is always equal to 8) and move the resolution computation logic to TimeManagement.
2023-02-21Kernel: Fix const-correctness issue in StorageManagementAndreas Kling
We have to take the StorageDevice as a mutable reference, otherwise we can't perform any interesting I/O operations on it.
2023-02-21Kernel: Make NVMeQueue const-correct internallyAndreas Kling
Store the DMA R/W page PhysicalPage object as an NNRP<T const>.