summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2022-07-19Kernel/Storage: Move AHCI and IDE code into new subdirectoriesLiav A
We do that to increase clarity of the major and secondary components in the subsystem. To ensure it's even more understandable, we rename the files to better represent the class within them and to remove redundancy in the name. Also, some includes are removed from the general components of the ATA components' classes.
2022-07-19Kernel+Userland: Remove GRAPHICS_IOCTL_GET_HEAD_EDID ioctlLiav A
We are able to read the EDID from SysFS, therefore there's no need to provide this ioctl on a DisplayConnector anymore. Also, now we can simply require the video pledge to be set before doing any ioctl on a DisplayConnector.
2022-07-19Userland: Make graphics_connector_get_head_edid to read EDID from SysFSLiav A
The EDID blob is now exposed in the SysFS for each DisplayConnector, so we don't need to use the ioctl interface anymore to read the EDID.
2022-07-19Kernel/Devices: Abstract SysFS Device add/remove methods more properlyLiav A
It is starting to get a little messy with how each device can try to add or remove itself to either /sys/dev/block or /sys/dev/char directories. To better do this, we introduce 4 virtual methods to take care of that, so until we ensure all nodes in /sys/dev/block and /sys/dev/char are actual symlinks, we allow the Device base class to call virtual methods upon insertion or before being destroying, so it add itself elegantly to either of these directories or remove itself when needed. For special cases where we need to create symlinks, we have two virtual methods to be called otherwise to do almost the same thing mentioned before, but to use symlinks instead.
2022-07-19Kernel/SysFS: Add exposing interface for DisplayConnectorsLiav A
Under normal conditions (when mounting SysFS in /sys), there will be a new directory in the /sys/devices directory called "graphics". For now, under that directory there will be only a sub-directory called "connectors" which will contain all DisplayConnectors' details, each in its own sub-directory too, distinguished in naming with its minor number. Therefore, /sys/devices/graphics/connectors/MINOR_NUMBER/ will contain: - General device attributes such as mutable_mode_setting_capable, double_buffering_capable, flush_support, partial_flush_support and refresh_rate_support. These values are exposed in the ioctl interface of the DisplayConnector class too, but these can be useful later on for command line utilities that want/need to expose these basic settings. - The EDID blob, simply named "edid". This will help userspace to fetch the edid without the need of using the ioctl interface later on.
2022-07-15Kernel: Add some inline capacity to find_regions_intersectingHendiadyoin1
This should avoid some allocations during simple cases of munmap, mprotect and msync, where you usually don't have a lot of regions anyway
2022-07-15Kernel: Try to set [cm]time in Inode::did_modify_contentsHendiadyoin1
This indirectly resolves a fixme in sys$msync
2022-07-15Kernel: Handle multiple regions in sys$msyncHendiadyoin1
2022-07-15Kernel+LibC: Add posix_fallocate syscallHendiadyoin1
2022-07-15Kernel: Use find_last_split_view to get the executable name in do_execHendiadyoin1
2022-07-15Kernel/SysFS: Add /sys/devices/storage directoryLiav A
This change in fact does the following: 1. Use support for symlinks between /sys/dev/block/ storage device identifier nodes and devices in /sys/devices/storage/{LUN}. 2. Add basic nodes in a /sys/devices/storage/{LUN} directory, to let userspace to know about the device and its details.
2022-07-15Kernel/Devices: Add two protected methods for DeviceManagement functionsLiav A
These methods are essentially splitted from the after_inserting method and the will_be_destroyed method so later on we can allow Storage devices to override the after_inserting method and the will_be_destroyed method while still being able to use shared functionality as before, such as adding the device to and removing it from the device list.
2022-07-15Kernel: Declare BlockDevice::is_block_device method protectedLiav A
2022-07-15Kernel/SysFS: Adapt USB plug code to work with SysFS patternsLiav A
2022-07-15Kernel/SysFS: Mark SysFSDirectory traverse and lookup methods as finalLiav A
This enforces us to remove duplicated code across the SysFS code. This results in great simplification of how the SysFS works now, because we enforce one way to treat SysFSDirectory objects.
2022-07-15Kernel/SysFS: Reduce the responsibilities of the Registry objectLiav A
Instead, let the /sys/dev/block and /sys/dev/char directories to handle the registering part of SysFSDeviceComponents by themselves.
2022-07-15Kernel/SysFS: Add Symbolic link functionality to the filesystemLiav A
This will be used later on to help connecting a node at /sys/dev/block/ that represents a Storage device to a directory in /sys/devices/storage/ with details on that device in that directory.
2022-07-15Kernel/SysFS: Add two methods related to relative paths for componentsLiav A
These methods will be used later on to introduce symbolic links support in the SysFS, so the kernel will be able to resolve relative paths of components in filesystem based on using the m_parent_directory pointer in each SysFSComponent object.
2022-07-15Kernel/Storage: Add LUN address to each StorageDeviceLiav A
LUN address is essentially how people used to address SCSI devices back in the day we had these devices more in use. However, SCSI was taken as an abstraction layer for many Unix and Unix-like systems, so it still common to see LUN addresses in use. In Serenity, we don't really provide such abstraction layer, and therefore until now, we didn't use LUNs too. However (again), this changes, as we want to let users to address their devices under SysFS easily. LUNs make sense in that regard, because they can be easily adapted to different interfaces besides SCSI. For example, for legacy ATA hard drive being connected to the first IDE controller which was enumerated on the PCI bus, and then to the primary channel as slave device, the LUN address would be 0:0:1. To make this happen, we add unique ID number to each StorageController, which increments by 1 for each new instance of StorageController. Then, we adapt the ATA and NVMe devices to use these numbers and generate LUN in the construction time.
2022-07-15Kernel/Storage: Declare NVMeNameSpace constructor as privateLiav A
Also, don't mark it as explicit.
2022-07-15Kernel: Export both interface type and command set of a StorageDeviceLiav A
2022-07-15Kernel/SysFS: Rename Devices code folder => DeviceIdentifiersLiav A
This folder in the SysFS code represents everything related to /sys/dev, which is a directory meant to be a convenient interface to track all IDs of all block and character devices (ID = major:minor numbers).
2022-07-15Kernel/USB: Support UHCI full speed bandwidth reclamationb14ckcat
2022-07-15Kernel/Storage: Check IDE error condition under the correct lockLiav A
This bug was probably around for a very long time, but it is noticeable only under VirtualBox as it generated an non fatal error which caused a kernel panic because we VERIFYed the wrong lock to be locked.
2022-07-15Kernel/Graphics: Remove GenericGraphicsAdapter::vga_compatible methodLiav A
There's no point in keeping this method as we don't really care if a graphics adapter is VGA compatible or not because we don't use this method anymore.
2022-07-14Kernel+Userland: Rename prefix of user_physical => physicalLiav A
There's no such supervisor pages concept, so there's no need to call physical pages with the "user_physical" prefix anymore.
2022-07-14Kernel+Userland: Remove supervisor pages conceptLiav A
There's no real value in separating physical pages to supervisor and user types, so let's remove the concept and just let everyone to use "user" physical pages which can be allocated from any PhysicalRegion we want to use. Later on, we will remove the "user" prefix as this prefix is not needed anymore.
2022-07-14Kernel: Allocate user physical pages instead of supervisor ones for DMALiav A
We are limited on the amount of supervisor pages we can allocate, so don't allocate from that pool. Supervisor pages are always below 16 MiB barrier so using those was crucial when we used devices like the ISA SoundBlaster 16 card, because that device required very low physical addresses to be used.
2022-07-14Kernel: Don't lock the scheduler in ProcFSOverallProcesses::try_generateDaniel Bertalan
This used to be needed to protect accesses to Process::all_instances. That list now has a more granular lock, so we don't need to take the scheduler lock. This fixes a crash when we try to access a locked Thread::m_fds in the loop, which calls Thread::block, which then asserts that the scheduler lock must not be locked by the current process. Fixes #13617
2022-07-13Kernel/Graphics: Allocate VGA window region according to the usual rulesLiav A
We should not allocate a kernel region inside the constructor of the VGATextModeConsole class. We do use MUST() because allocation cannot fail at this point, but that happens in the static factory method instead.
2022-07-13Kernel/Graphics: Rename m_vga_region => m_vga_window_regionLiav A
2022-07-13Kernel/Graphics: Rename TextModeConsole => VGATextModeConsoleLiav A
This change represents well the fact that the text mode console is based on VGA text mode.
2022-07-13Kernel/Graphics: Remove unnecessary VGAConsole class abstractionLiav A
The original intention was to support other types of consoles based on standard VGA modes, but it never came to an implementation, nor we need such feature at all. Therefore, this class is not needed and can be removed.
2022-07-12Everywhere: Use default StringView constructor over nullptrsin-ack
While null StringViews are just as bad, these prevent the removal of StringView(char const*) as that constructor accepts a nullptr. No functional changes.
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Everywhere: Explicitly specify the size in StringView constructorssin-ack
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
2022-07-12Kernel/Graphics: Simplify initialization flow explanation commentLiav A
Most of it was not relevant anymore to what we do in the initialization method anyway, and now it represents it quite well and "to the point".
2022-07-12Kernel/Graphics: Fix comparison of framebuffer type in initializationLiav A
2022-07-12Kernel/Graphics: Remove VGA folder and its contentLiav A
We never supported VGA framebuffers and that folder was a big misleading part of the graphics subsystem. We do support bare-bones VGA text console (80x25), but that only happens to be supported because we can't be 100% sure we can always initialize framebuffer so in the worst scenario we default to plain old VGA console so the user can still use its own machine. Therefore, the only remaining parts of VGA is in the GraphicsManagement code to help driving the VGA text console if needed.
2022-07-12Kernel: Annotate all `KBuffer` and `DoubleBuffer` with a custom nameTim Schumacher
2022-07-11Kernel: Stop committing pages for COW of uncommitted pages on sys$forkIdan Horowitz
Uncommitted pages (shared zero pages) can not contain any existing data and can not be modified, so there's no point to committing a bunch of extra pages to cover for them in the forked child.
2022-07-10Kernel: Stop leaking leftover committed cow pages from forked processesIdan Horowitz
Since both the parent process and child process hold a reference to the COW committed set, once the child process exits, the committed COW pages are effectively leaked, only being slowly re-claimed each time the parent process writes to one of them, realizing it's no longer shared, and uncommitting it. In order to mitigate this we now hold a weak reference the parent VMObject from which the pages are cloned, and we use it on destruction when available to drop the reference to the committed set from it as well.
2022-07-10Kernel: Stop leaking first thread on errors in sys$forkIdan Horowitz
Until the thread is first set as Runnable at the end of sys$fork, its state is Invalid, and as a result, the Finalizer which is searching for Dying threads will never find it if the syscall short-circuits due to an error condition like OOM. This also meant the parent Process of the thread would be leaked as well.
2022-07-10Kernel+LibC+LibCore: Pass fcntl extra argument as pointer-sized variablegggggg-gggggg
The extra argument to fcntl is a pointer in the case of F_GETLK/F_SETLK and we were pulling out a u32, leading to pointer truncation on x86_64. Among other things, this fixes Assistant on x86_64 :^)
2022-07-10Kernel+SystemServer: Make KCOVDevice a character deviceLiav A
This device should not be a block device, as in Serenity, block devices represent an interface to either disk partitions or storage devices.
2022-07-10Kernel: Support sys$connect to LocalSockets with short sockaddr_unsIdan Horowitz
This is not explicitly specified by POSIX, but is supported by other *nixes, already supported by our sys$bind, and expected by various programs. While were here, also clean up the user memory copies a bit.
2022-07-10Kernel: Stop reporting POLLHUP exclusively when available in sys$pollIdan Horowitz
As per Dr. Posix, unlike POLLERR and POLLNVAL, POLLHUP is only mutually exclusive with POLLOUT, all other events may be reported together with it.
2022-07-10Kernel: Remove unused WriteNotOpen File BlockFlagIdan Horowitz
2022-07-10Kernel: Report POLLNVAL events in sys$poll instead of returning EBADFIdan Horowitz
As required by Dr. Posix.