summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2022-07-27Everywhere: Make the codebase more architecture awareUndefine
2022-07-27Kernel: Move SysFS USB create functionb14ckcat
2022-07-27Kernel: Fix USB hotplug crashb14ckcat
Currently the SysFS node for USB devices is only initialized for USB hubs, which means it will cause a kernel crash upon being dereferenced in a non-hub device. This fixes the problem by making initialization happen for all USB devices.
2022-07-25Kernel: Fix incorrect return type on aarch64Filiph Sandström
InterruptController's model incorrectly returned a char[] instead of a StringView.
2022-07-25Kernel/LibC: Implement posix syscall clock_getres()zzLinus
2022-07-24Kernel: Fix L1/L2/L3 cache conditionals in ProcFSCPUInformationLinus Groh
2022-07-24Kernel/SysFS: Fix parent directory hierarchy with symbolic linksLiav A
We should actually start counting from the parent directory and not from the symbolic link as it will represent a wrong count of hops from the actual mountpoint. The symlinks in /sys/dev/block and /sys/dev/char worked only by luck, because I have set it to the wrong parent directory which is the /sys/dev directory, so with the symlink it was 3 hops to /sys, together with the root directory, therefore, everything seemed to work. Now that the device symlinks in /sys/dev/block and /sys/dev/char are set to the right parent directory and we start measure hops from root directory with the parent directory of a symlink, everything seem to work correctly now.
2022-07-23Kernel+Userland: Add ioctl to set process ownership of DisplayConnectorLiav A
Now that the infrastructure of the Graphics subsystem is quite stable, it is time to try to fix a long-standing problem, which is the lack of locking on display connector devices. Reading and writing from multiple processes to a framebuffer controlled by the display connector is not a huge problem - it could be solved with POSIX locking. The real problem is some program that will try to do ioctl operations on a display connector without the WindowServer being aware of that which can lead to very bad situations, for example - assuming a framebuffer is encoded at a known resolution and certain display timings, but another process changed the ModeSetting of the display connector, leading to inconsistency on the properties of the current ModeSetting. To solve this, there's a new "master" ioctl to take "ownership" and another one to release that ownership of a display connector device. To ensure we will not hold a Process object forever just because it has an ownership over a display connector, we hold it with a weak reference, and if the process is gone, someone else can take an ownership.
2022-07-23Kernel+Userland: Rename FB.h => Graphics.hLiav A
This header file represents the entire interface between the kernel and userland, and as such, no longer should be called FB.h but something that represents the whole graphics subsystem.
2022-07-23Kernel/Graphics: Remove out-of-context comment noteLiav A
2022-07-22Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_'Linus Groh
2022-07-22LibC: Implement `pthread_cancel`Tim Schumacher
2022-07-22Kernel+LibC: Don't hardcode the maximum signal number everywhereTim Schumacher
2022-07-21Kernel: Move DiskPartition up into Kernel/StorageSamuel Bowman
Everything in Kernel/Storage/Partition but DiskPartition has been moved into LibPartiton. This makes the Partition directory unnecessary so DiskPartition is moved up into Kernel/Storage.
2022-07-21Kernel+LibPartition: Move GUIDPartitionTable into LibPartitionSamuel Bowman
2022-07-21Kernel+LibPartition: Move EBRPartitionTable into LibPartitionSamuel Bowman
2022-07-21Kernel+LibPartition: Move MBRPartitionTable into LibPartitionSamuel Bowman
2022-07-21Kernel+LibPartition: Move PartitionTable into LibPartitionSamuel Bowman
2022-07-21Kernel+LibPartition: Move DiskPartitionMetadata into LibPartitionSamuel Bowman
This commit creates a new library LibPartition which will contain partition related code sharable between Kernel and Userland and includes DiskPartitionMetadata as the first shared class.
2022-07-21Kernel: Support F_SETLKW in fcntlIdan Horowitz
2022-07-21Kernel: Clean up sys$futex and add support for cross-process futexesIdan Horowitz
2022-07-21Kernel: Propagate OOM conditions out of sys$futexIdan Horowitz
2022-07-21Kernel: Remove the Socket::{protocol,}connect ShouldBlock argumentIdan Horowitz
This argument is always set to description.is_blocking(), but description is also given as a separate argument, so there's no point to piping it through separately.
2022-07-19Kernel: Don't check that interrupts are enabled during early bootkleines Filmröllchen
The interrupts enabled check in the Kernel mutex is there so that we don't lock mutexes within a spinlock, because mutexes reenable interrupts and that will mess up the spinlock in more ways than one if the thread moves processors. This check is guarded behind a debug flag because it's too hard to fix all the problems at once, but we regressed and weren't even getting to init stage 2 with it enabled. With this commit, we get to stage 2 again. In early boot, there are no interrupts enabled and spinlocks used, so we can sort of kind of safely ignore the interrupt state. There might be a better solution with another boot state flag that checks whether APs are up (because they have interrupts enabled from the start) but that seems overkill.
2022-07-19Kernel/USB: Make UHCI descriptor pool thread-safeb14ckcat
Right now the TD and QH descriptor pools look to be susceptible to a race condition in the event they are accessed simultaneously by separate threads making USB transfers. This fix does not seem to add any noticeable overhead.
2022-07-19Kernel/Storage: Remove redundant reference to a controller in IDEChannelLiav A
IDEChannel which is an ATAPort derived class holded a NonnullRefPtr to a parent IDEController, although we can easily defer the usage of it to not be in the IDEChannel code at all, so it allows to keep NonnullRefPtr to the parent ATAController in the ATAPort base class and only there.
2022-07-19Kernel/Storage: Introduce basic abstraction layer for ATA componentsLiav A
This abstraction layer is mainly for ATA ports (AHCI ports, IDE ports). The goal is to create a convenient and flexible framework so it's possible to expand to support other types of controller (e.g. Intel PIIX and ICH IDE controllers) and to abstract operations that are possible on each component. Currently only the ATA IDE code is affected by this, making it much cleaner and readable - the ATA bus mastering code is moved to the ATAPort code so more implementations in the near future can take advantage of such functionality easily. In addition to that, the hierarchy of the ATA IDE code resembles more of the SATA AHCI code now, which means the IDEChannel class is solely responsible for getting interrupts, passing them for further processing in the ATAPort code to take care of the rest of the handling logic.
2022-07-19Kernel/Storage: Move ATA device signature definitions to a general fileLiav A
2022-07-19Kernel/Storage: Merge IDE functionality from BusMasterChannel to ChannelLiav A
This simplifies the flow of how things work currently and is a step for more improvements in the next commits.
2022-07-19Kernel/Storage: Rename ATA.h => Definitions.hLiav A
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.