summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2023-02-21Kernel: Make NVMeQueue const-correct internallyAndreas Kling
Store the DMA R/W page PhysicalPage object as an NNRP<T const>.
2023-02-21Kernel: Fix const-correctness of PCI::DeviceIdentifier usageAndreas Kling
2023-02-21Kernel: Make NNRP<PhysicalPage const> possibleAndreas Kling
This wasn't possible before as ref() and unref() were non-const.
2023-02-19Kernel/IntelGraphics: Move PLL handling code to a different fileLiav A
Dealing with the specific details of how to program a PLL should be done in a separate file to ensure we can easily expand it to support future generations of the Intel graphics device.
2023-02-19Kernel/Graphics: Return ENODEV if there's no valid EDID to returnLiav A
ENODEV better represents the fact that there might be no display device (e.g. a monitor) connected to the connector, therefore we should return this error. Another reason to not use ENOTIMPL is that it's a requirement for all DisplayConnectors to put a valid EDID in place even for a hardware we don't currently support mode-setting in runtime.
2023-02-19Kernel/Graphics: Allow Intel DisplayConnector to not have consoleLiav A
2023-02-19Kernel/IntelGraphics: Move DisplayPlane enable code to derived classesLiav A
Instead of doing that on the IntelDisplayPlane class, let's have this in derived classes so these classes can decide how to use the settings that were provided before calling the enable method.
2023-02-19Kernel/IntelGraphics: Add Generation enum to the Definitions fileLiav A
This will be used to annotate which Generation is being used for each Intel iGPU we discover.
2023-02-19Kernel/IntelGraphics: Move pipe management to the Transcoder classLiav A
It became apparent to me that future generations of the Intel graphics chipset utilize the same register set as part of the Transcoder register set. Therefore, it should be included now in the Transcoder class.
2023-02-19Kernel/Graphics: Introduce the IntelDisplayConnectorGroup classLiav A
In the real world, graphics hardware tend to have multiple display connectors. However, usually the connectors share one register space but still keeping different PLL timings and display lanes. This new class should represent a group of multiple display connectors working together in the same Intel graphics adapter. This opens an opportunity to abstract the interface so we could support future Intel iGPU generations. This is also a preparation before the driver can support newer devices and utilize their capabilities. The mentioned preparation is applied in a these aspects: 1. The code is splitted into more classes to adjust to future expansion. 2 classes are introduced: IntelDisplayPlane and IntelDisplayTranscoder, so the IntelDisplayPlane controls the plane registers and second class controls the pipeline (transcoder, encoder) registers. On gen4 it's not really useful because there are probably one plane and one encoder to care about, but in future generations, there are likely to be multiple transcoders and planes to accommodate multi head support. 2. The set_edid_bytes method in the DisplayConnector class can now be told to not assume the provided EDID bytes are always invalid. Therefore it can refrain from printing error messages if this flag parameter is true. This is useful for supporting real hardware situation when on boot not all ports are connected to a monitor, which can result in floating bus condition (essentially all the bytes we read are 0xFF). 3. An IntelNativeDisplayConnector could now be set to flag other types of connections such as eDP (embedded DisplayPort), Analog output, etc. This is important because on the Intel gen4 graphics we could assume to have one analog output connector, but on future generations this is very likely to not be the case, as there might be no VGA outputs, but rather only an eDP connector which is converted to VGA by a design choice of the motherboard manufacturer. 4. Add ConnectorIndex to IntelNativeDisplayConnector class - Currently this is used to verify we always handle the correct connector when doing modesetting. Later, it will be used to locate special settings needed when handling connector requests. 5. Prepare to support more types of display planes. For example, the Intel Skylake register set for display planes is a bit different, so let's ensure we can properly support it in the near future.
2023-02-19Kernel+Userland: Add constants subdirectory at /sys/kernel directoryLiav A
This subdirectory is meant to hold all constant data related to the kernel. This means that this data is never meant to updated and is relevant from system boot to system shutdown. Move the inodes of "load_base", "cmdline" and "system_mode" to that directory. All nodes under this new subdirectory are generated during boot, and therefore don't require calling kmalloc each time we need to read them. Locking is also not necessary, because these nodes and their data are completely static once being generated.
2023-02-19Kernel: Remove unnecessary include from SysFS PowerStateSwitch codeLiav A
I added that include in 2e55956784ac0c61fe877c316867074e0f432452 by a mistake, so we should get rid of it as soon as possible.
2023-02-19Kernel/FileSystem: Don't assume flags for root filesystem mount flagsLiav A
This is considered somewhat an abstraction layer violation, because we should always let userspace to decide on the root filesystem mount flags because it allows the user to configure the mount table to preferences that they desire. Now that SystemServer is modified to re-mount the root mount with the desired flags, we can just mount the root filesystem without assuming special flags.
2023-02-19Kernel/FileSystem: Fix check of read offset for the RAMFSInode codeLiav A
The check of ensuring we are not trying to read beyond the end of the inode data buffer is already there, it's just that we need to disallow further reading if the read offset equals to the inode data size.
2023-02-19Kernel/FileSystem: Add check of read offset for the FATInode codeLiav A
Apparently we lacked this important check from the beginning of this piece of code. This check is crucial to ensure we only give back data being related to the FATInode data buffer and nothing beyond it.
2023-02-19Kernel: Support sending filedescriptors with sendmsg(2) and SCM_RIGHTSPeter Elliott
This is necessary to support the wayland protocol. I also moved the CMSG_* macros to the kernel API since they are used in both kernel and userspace. this does not break ntpquery/SCM_TIMESTAMP.
2023-02-19Kernel: Change polarity of weak ownership between Inode and LocalSocketPeter Elliott
There was a bug in which bound Inodes would lose all their references (because localsocket does not reference them), and they would be deallocated, and clients would get ECONNREFUSED as a result. now LocalSocket has a strong reference to inode so that the inode will live as long as the socket, and Inode has a weak reference to the socket, because if the socket stops being referenced anywhere it should not be bound. This still prevents the reference loop that 220b7dd77905b7d573ded093cf88d2dc51f57c69 was trying to fix.
2023-02-19Kernel: Support F_DUPFD_CLOEXEC command to fcntl(2)Peter Elliott
Specified by POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
2023-02-18Kernel: Dont crash if power states gets set to an invalid valueUndefine
2023-02-18Kernel/aarch64: Disable memory access alignment checkTimon Kruiper
Even though we currently build all of Userland and the Kernel with the -mstrict-align flag, the compiler will still emit unaligned memory accesses. To work around this, we disable the check for now. See https://github.com/SerenityOS/serenity/issues/17516 for the relevant issue.
2023-02-18Kernel/aarch64: Call handle_crash on unknown exceptionsTimon Kruiper
This is useful for debugging, as it will now print out a userspace backtrace, and optionally also dump the memory regions of the process.
2023-02-17Revert "Kernel: Migrate ‘main id registerʼ access in Aarch64 MMIO"Andrew Kaster
This patch needed more review than it got. This reverts commit a6526cd90c73534de340136b856b519a09c45f26.
2023-02-17Revert "Kernel: Remove old ‘main id register accessorʼ for Aarch64"Andrew Kaster
This patch needed more review than it got. This reverts commit 84e8d5f41842f6c3f9f613f3570f669328fe4d06.
2023-02-15Everywhere: Change all XXX into FIXME or remove as appropriateBen Wiederhake
2023-02-15Kernel/aarch64: Implement Thread Local StorageTimon Kruiper
This commit adds Processor::set_thread_specific_data, and this function is used to factor out architecture specific implementation of setting the thread specific data. This function is implemented for aarch64 and x86_64, and the callsites are changed to use this function instead.
2023-02-15Kernel/aarch64: Remove tpidr_el0 from RegisterStateTimon Kruiper
In the next commit, this register will be populated by directly writing to it, instead of using the RegisterState mechanism.
2023-02-15Kernel/aarch64: Add implementations for safe_memset and safe_strnlenTimon Kruiper
They currently do not actually implement a safe memset or safe strnlen, but this initial implementation works fine for now.
2023-02-15Kernel/aarch64: Implement storing and restoring floating-point registersTimon Kruiper
2023-02-15Kernel/aarch64: Do not trap floating-point instructionsTimon Kruiper
This requires setting the FPEN field of the Architectural Feature Access Control Register (CPACR_EL1) to 0b11.
2023-02-15Kernel/aarch64: Handle SVC exception by calling syscall_handlerTimon Kruiper
The SVC (supervisor call) instruction is used in userland to do syscalls, and this commit adds the handling of syscalls to Interrupts.cpp.
2023-02-12AK: Add conversion functions for packed DOS time formatOllrogge
This also adjusts the FATFS code to use the new functions and removes the now redundant old conversion functions.
2023-02-10Kernel: Remove old ‘main id register accessorʼ for Aarch64konrad
2023-02-10Kernel: Migrate ‘main id registerʼ access in Aarch64 MMIOkonrad
2023-02-10Kernel: Provide better types in MIDR register accessor for Aarch64konrad
This avoids unnecessary and-masks during reading.
2023-02-10AK: Add a new method to propagate errno while printing errors in KernelLiav A
This new method is meant to be used in both userspace and kernel code. The idea is to allow printing of a verbose message and then returning an errno code which is the proper mechanism for kernel code because we should almost always assume that such error will be propagated back to userspace in some way, so the userspace code could reasonably decode it. For userspace code however, this new method is meant to be a simple wrapper for Error::from_string_view, because for most invocations, it's much more useful to have a verbose & literal error than a errno code, so we simply ignore that errno code completely in such context.
2023-02-10Kernel: Return proper errno codes from Coredump::write_regions methodLiav A
2023-02-10Kernel/Net: Propagate proper errno codes from determine_network_deviceLiav A
Returning literal strings is not the proper action here, because we should always assume that error could be propagated back to userland, so we need to keep a valid errno when returning an Error.
2023-02-10Kernel/VirtIOGPU: Propagate proper errno codes from query_and_set_edidLiav A
Returning literal strings is not the proper action here, because we should always assume that error could be propagated back to userland, so we need to keep a valid errno when returning an Error.
2023-02-10AK+Everywhere: Do not implicitly copy variables in TRY macrosTimothy Flynn
For example, consider cases where we want to propagate errors only in specific instances: auto result = read_data(); // something like ErrorOr<ByteBuffer> if (result.is_error() && result.error().code() != EINTR) continue; auto bytes = TRY(result); The TRY invocation will currently copy the byte buffer when the expression (in this case, just a local variable) is stored into _temporary_result. This patch binds the expression to a reference to prevent such copies. In less trival invocations (such as TRY(some_function()), this will incur only temporary lifetime extensions, i.e. no functional change.
2023-02-10Everywhere: Remove needless copies of Error / ErrorOr instancesTimothy Flynn
Either take the underlying objects with release_* methods or move() the instances around.
2023-02-10Kernel: Explicitly copy Plan9FS read errors to registered delegatesTimothy Flynn
2023-02-10Kernel: Store socket errors as errno codes rather than ErrorOr valuesTimothy Flynn
2023-02-08Everywhere: Use ReadonlySpan<T> instead of Span<T const>MacDue
2023-02-08Kernel: Use `AK::Stream` to write packed binary dataTim Schumacher
2023-02-08Kernel: Modernize Error handling when serializing directory entriesTim Schumacher
2023-02-08Kernel: Update stored registers in a thread's tracer on SIGSTOPItamar
This is needed so we can retrieve the registers of a traced thread that was attached to while it was running. Attaching with ptrace to a running thread sends SIGSTOP to it.
2023-02-08Kernel: Update registers in tracer when attaching to a stopped threadItamar
2023-02-08Kernel/aarch64: Execute first userspace processTimon Kruiper
This adds the necessary code to init.cpp to be able to execute the first userspace process. To do this, first the filesystem code is initialized, which will use the ramdisk embedded into the kernel image. Then the first userspace process, /bin/SystemServer is executed. :^) The ramdisk code is used as it is useful for the bring-up of the aarch64 port, however once the kernel has support for better ram-based filesystems, the ramdisk code will be removed again.
2023-02-08Kernel/aarch64: Embed disk image into kernel binaryTimon Kruiper
This allows us to actually boot to userspace in the next commit! :^)
2023-02-08Kernel/aarch64: Do not dump register state on every page faultTimon Kruiper
This became very spammy, and is not needed anymore since we now correctly handle page faults.