summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2021-09-26Kernel: Add UART class for aarch64Nico Weber
2021-09-26Kernel: Add Mailbox::set_clock_rate()Nico Weber
2021-09-26Kernel: Add a GPIO class for aarch64Nico Weber
This allows configuring the alternate pin functions and pin pull up/down states, which is needed for using the UART.
2021-09-23Kernel: Define PT_READ_I and PT_READ_DJelle Raaijmakers
Looking at how these two constants are commonly used in other systems, we should be able to mimic their behavior using our PT_PEEK constant. For example, see: https://man.netbsd.org/NetBSD-6.0.1/i386/ptrace.2
2021-09-23Kernel: Allow PROT_NONE in mmap and mprotect for stack regionsEric Seifert
To allow for userspace guard pages (ruby uses this). Redundant since serenity creates them automatically, but should be allowed anyway.
2021-09-21Kernel: Use AK::Variant default initialization where appropriateBen Wiederhake
2021-09-20Kernel: Clean up PCI::Device namespace formattingBen Wiederhake
2021-09-19Kernel: Store device class name as member of VirtIO devicesIdan Horowitz
This ensures we dont try to hold the PCI Access mutex under IRQ when printing VirtIO debug logs (which is not allowed and results in an assertion). This is also relatively free, as it requires no allocations (we're just storing a pointer to the rodata section).
2021-09-19Kernel: Use StringView literals in VirtIO::determine_device_class()Idan Horowitz
Since the return type is StringView we can just create them at compile time and avoid the run-time construction.
2021-09-19Kernel: Add a Mailbox class for aarch64Nico Weber
As a demo, query the firmware version. `Meta/serenity.sh gdb aarch64` can be used to observe that qemu puts 0x548E1 in x0 in response to this mailbox message.
2021-09-19Kernel: Add a MMIO class for aarch64Nico Weber
It doesn't do anything yet except figure out the peripheral base address. Very likely belongs in Kernel, not Prekernel, eventually.
2021-09-19Kernel: Use new halt() for all our halting needs in aarch64 PrekernelNico Weber
2021-09-19Kernel: Add __stack_chk_fail to aarch64 Prekernel initNico Weber
This is needed for some functions with local variables. We'll grow such a function soon.
2021-09-19Kernel: Add support for O_NONBLOCK in pipe syscallEric Seifert
While working on a port, I saw a pipe creation fail due to missing nonblock support in pipe syscall.
2021-09-19Kernel/VirtIO: Remove lazy allocation of VirtIO::Device BAR regionsSahan Fernando
This fixes a Kernel Panic where the lazy allocation triggers inside an ISR and grabs a mutex, which isn't allowed when interrupts are disabled. This also fixes a bug where the mapping for VirtIO device BARs is never allocated. #9876
2021-09-18Kernel: Let MouseDevice and KeyboardDevice write method return EINVALPrzemysław R. Kusiak
Currently, writing anything to `/dev/mouse0` or `/dev/keyboard0` causes the Kernel to panic. The reason for this is that `[Mouse,Keyboard]Device::write` always returns 0, which is explicitly prohibited by `VERIFY` macro in `Process::sys$write`. The fix seems trivial; `write` should return EINVAL instead (as is the case with, for example, `KCOVDevice`).
2021-09-18Kernel/Net: Enable usage of RTL8168E and RTL8168H in RTL8168 driverLiav A
I tested both (version 15 and 30 of the RTL8168 chipset) with PCI- passthrough of these cards, and they seem to work just fine with the driver.
2021-09-18Kernel/Memory: Add more super pages to satisfy contiguous allocationsLiav A
When testing the RTL8168 driver, it seems we can't allocate super pages anymore. Either we expand the super pages range, or find a solution to dynamically expand the range (or let drivers utilize other ranges).
2021-09-18Kernel/Storage: Tidy up RamdiskDevice classLiav A
2021-09-17Kernel: Don't link Prekernel against kernel_heapNico Weber
This was added in b5c98ede084e5d29, but it looks like a copy-paste mistake from Kernel/CMakeLists.txt. Unbreaks building for aarch64.
2021-09-17Kernel/Devices: Use try_create_device helper for SB16Liav A
2021-09-17Kernel/Devices: Use try_create_device helper for ConsoleDeviceLiav A
2021-09-17Kernel/Devices: Move ConsoleDevice into the Devices source directoryLiav A
2021-09-17Kernel: Introduce the DeviceManagement singletonLiav A
This singleton simplifies many aspects that we struggled with before: 1. There's no need to make derived classes of Device expose the constructor as public anymore. The singleton is a friend of them, so he can call the constructor. This solves the issue with try_create_device helper neatly, hopefully for good. 2. Getting a reference of the NullDevice is now being done from this singleton, which means that NullDevice no longer needs to use its own singleton, and we can apply the try_create_device helper on it too :) 3. We can now defer registration completely after the Device constructor which means the Device constructor is merely assigning the major and minor numbers of the Device, and the try_create_device helper ensures it calls the after_inserting method immediately after construction. This creates a great opportunity to make registration more OOM-safe.
2021-09-16Kernel: Unblock tracer process in Process:unblock_waiters()Itamar
Since the tracer process may not be our parent process, we need to explicitly unblock it (instead of the parent) if we are being traced.
2021-09-16Kernel: Allow calling sys$waitid on traced, non-child processesItamar
Previously, attempting to call sys$waitid on non-child processes returned ECHILD. That prevented debugging non-child processes by attaching to them during runtime (as opposed to forking and debugging the child, which is what was previously supported). We now allow calling sys$waitid on a any process that is being traced by us, even if it's not our child.
2021-09-16Kernel: Use move to avoid unnecessary ref/unref of network device RefPtrBrian Gianforcaro
Flagged by pvs-studio as a potential perf optimization.
2021-09-16Kernel: Fetch range once for each iteration of find_regions_intersectingBrian Gianforcaro
pvs-studio flagged this as a potential optimization.
2021-09-16Kernel: Only instantiate main_program_metadata in the scope it's neededBrian Gianforcaro
pvs-studio flagged this as a potential perf optimization.
2021-09-16Kernel: Make IPv4SocketTuple operator== by referenceBrian Gianforcaro
No reason for this to copy when comparing equality.
2021-09-16Kernel: Pack Flock struct tighterBrian Gianforcaro
Flagged by pvs-studio, ordering the members from largest to smallest allows us to save a few bytes in the size of the struct.
2021-09-16Kernel+LibC: Pack SC_stat_params struct tighterBrian Gianforcaro
Flagged by pvs-studio, ordering the members from largest to smallest allows us to save a few bytes in the size of the struct.
2021-09-16Kernel+LibC: Pack SC_mount_params struct tighterBrian Gianforcaro
Flagged by pvs-studio, ordering the members from largest to smallest allows us to save a few bytes in the size of the struct.
2021-09-16Kernel+LibC: Pack SC_setsockopt_params struct tighterBrian Gianforcaro
Flagged by pvs-studio, ordering the members from largest to smallest allows us to save a few bytes in the size of the struct.
2021-09-16Kernel+LibC: Pack SC_accept4_params struct tighterBrian Gianforcaro
Flagged by pvs-studio, ordering the members from largest to smallest allows us to save a few bytes in the size of the struct.
2021-09-16Kernel+LibC: Pack SC_inode_watcher_add_watch_params struct betterBrian Gianforcaro
Flagged by pvs-studio, ordering the members from largest to smallest allows us to save a few bytes in the size of the struct.
2021-09-16Kernel: Weakly hold on to the file in LocalSocketsin-ack
Because we were holding a strong ref to the OpenFileDescription in LocalSocket and a strong ref to the LocalSocket in Inode, we were creating a reference cycle in the event of the socket being cleaned up after the file description did (i.e. unlinking the file before closing the socket), because the file description never got destructed.
2021-09-16Kernel: Drop the receive buffer when socket enters the TimeWait statesin-ack
The TimeWait state is intended to prevent another socket from taking the address tuple in case any packets are still in transit after the final close. Since this state never delivers packets to userspace, it doesn't make sense to keep the receive buffer around.
2021-09-15Kernel: Use move semantics in sys$sendfd()Andreas Kling
Avoid an unnecessary NonnullRefPtr<OpenFileDescription> copy.
2021-09-15Meta+Toolchain: Rename CMAKE_CXXFILT to SERENITY_CXXFILTAndrew Kaster
The "CMAKE_<foo>" variable namespace is reserved, and CXXFILT is not currently a variable known to upstream CMake.
2021-09-15Meta: Switch to a SuperBuild that splits host and target buildsAndrew Kaster
Replace the old logic where we would start with a host build, and swap all the CMake compiler and target variables underneath it to trick CMake into building for Serenity after we configured and built the Lagom code generators. The SuperBuild creates two ExternalProjects, one for Lagom and one for Serenity. The Serenity project depends on the install stage for the Lagom build. The SuperBuild also generates a CMakeToolchain file for the Serenity build to use that replaces the old toolchain file that was only used for Ports. To ensure that code generators are rebuilt when core libraries such as AK and LibCore are modified, developers will need to direct their manual `ninja` invocations to the SuperBuild's binary directory instead of the Serenity binary directory. This commit includes warning coalescing and option style cleanup for the affected CMakeLists in the Kernel, top level, and runtime support libraries. A large part of the cleanup is replacing USE_CLANG_TOOLCHAIN with the proper CMAKE_CXX_COMPILER_ID variable, which will no longer be confused by a host clang compiler.
2021-09-14Kernel: Disable lock rank enforcement by default for nowBrian Gianforcaro
There are a few violations with signal handling that I won't be able to fix it until later this week. So lets put lock rank enforcement under a debug option for now so other folks don't hit these crashes until rank enforcement is more fleshed out.
2021-09-13AK+Kernel: Avoid unescaped control chars in append_escaped_for_json()Ali Mohammad Pur
Otherwise it could produce invalid JSON.
2021-09-13Kernel: Deduplicate signpost perf event stringsAli Mohammad Pur
2021-09-13Kernel: Specialize Traits<(Nonnull)OwnPtr<T>> for KStringAli Mohammad Pur
To make it behave like a string, since KString is always stored as a (Nonnull)OwnPtr in the kernel.
2021-09-12Kernel: Add a class to wrap aarch64 MIDR_EL1Nico Weber
We'll need part_num() to determine the MMIO address base. It's 0x3F000000 on rpi3 but 0xFE000000 on rpi4.
2021-09-12Kernel: Put boot.S first in aarch64 Prekernel source listNico Weber
The better fix is to have a linker script. We'll need this to set the entry point to 0x80000 for bare-metal builds anyways. But I'd like to get some UART output in qemu before I add this (otherwise I can't check if the bare-metal version does anything), so put in this temporary kludge for now.
2021-09-12Kernel: Define __stack_chk_guard for aarch64 PrekernelNico Weber
Needed for functions that have local variables. In time we need to share this between aarch64 and intel, but while we figure out what exactly the aarch64 Prekernel should do, let's duplicate this.
2021-09-12Kernel: Build Prekernel with -fno-threadsafe-staticsNico Weber
Else, function-local statics create calls to __cxa_guard_acquire / __cxa_guard_release on aarch64, which we don't (yet?) implement. Since Prekernel is single-threaded, just sidestep that for now.
2021-09-12Kernel: Use AK::to_underlying in lock rank trackingBrian Gianforcaro
AK::to_underlying simplifies the code a bit, instead of having to manually cast to the underlying type.