summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2021-10-08Kernel: Fix -Wunreachable-code warnings from clangNico Weber
2021-10-07Kernel: Use find_largest_not_above in VirtualRangeAllocatorIdan Horowitz
Instead of iterating over the regions in the tree which is O(n), we can just use RedBlackTree's find_largest_not_above method, which is O(logn)
2021-10-07Kernel: Note if the page fault address is a destroyed smart pointerLuke Wilde
While I was working on LibWeb, I got a page fault at 0xe0e0e0e4. This indicates a destroyed RefPtr if compiled with SANITIZE_PTRS defined. However, the page fault handler didn't print out this indication. This makes the page fault handler print out a note if the faulting address looks like a recently destroyed RefPtr, OwnPtr, NonnullRefPtr, NonnullOwnPtr, ThreadSafeRefPtr or ThreadSafeNonnullRefPtr. It will only do this if SANITIZE_PTRS is defined, as smart pointers don't get scrubbed without it being defined.
2021-10-07Kernel: Add the /proc/stat ProcFS componentIdan Horowitz
This exposes a small subset of the information exposed by the Linux equivalent, and will be used to optimize applications that would like to know the current CPU usage statistics, but don't want to read all of the unrelated information in /proc/all
2021-10-07Kernel: Add Processor::time_spent_idle()Idan Horowitz
2021-10-07AK+Kernel: Make automatically locking RefPtr & co a kernel-only thingAndreas Kling
Some time ago, automatic locking was added to the AK smart pointers to paper over various race conditions in the kernel. Until we've actually solved the issues in the kernel, we're stuck with the locking. However, we don't need to punish single-threaded userspace programs with the high cost of locking. This patch moves the thread-safe variants of RefPtr, NonnullRefPtr, WeakPtr and RefCounted into Kernel/Library/.
2021-10-06Kernel: Don't retrieve possibly nonexistent APIC tableTim Schumacher
2021-10-06Kernel: Handle backspace for tab character in TTY cooked modePeter Elliott
Before, serenity would only backspace one character for a tab. This is the only feature that my OS has and serenity doesn't.
2021-10-05Kernel: Validate x86_64 address canonicality before SafeMem operationsIdan Horowitz
This ensures we don't GP on x86_64 when a non-canonical address is fed to a safe_foo() operation.
2021-10-05Kernel: Detect and store the virtual address bit width during CPU initIdan Horowitz
2021-10-03Kernel: Fix copy paste in VirtIO::RNG::class_name()Brian Gianforcaro
Ben noticed this copy paste error during code review. Co-authored-by: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
2021-10-03Kernel: Remove unused partition name APIBrian Gianforcaro
I was about to convert this to use KString, but then I realized it wasn't actually used at all, so lets remove it until the day it is needed.
2021-10-03Kernel: Remove now unused StorageDevice constructorBrian Gianforcaro
2021-10-03Kernel: Remove most String usage from storage_name() APIBrian Gianforcaro
This change is another minor step towards removing `AK::String` from the Kernel. Instead of dynamically allocating the storage_name we can instead allocate it via a KString in the factory for each device, and then push the device name down into the StorageDevice base class. We don't have a way of doing `AK::String::formatted(..)` with a KString at the moment, so cleaning that up will be left for a later day.
2021-10-03Kernel: Use `operator ""sv` in all purpose() implementationsBrian Gianforcaro
Previously there was a mix of returning plain strings and returning explicit string views using `operator ""sv`. This change switches them all to standardized on `operator ""sv` as it avoids a call to strlen.
2021-10-03Kernel: Use `operator ""sv` in all class_name() implementationsBrian Gianforcaro
Previously there was a mix of returning plain strings and returning explicit string views using `operator ""sv`. This change switches them all to standardized on `operator ""sv` as it avoids a call to strlen.
2021-10-03Kernel: Remove AK::String usage from Storage/StorageManagement.cppBrian Gianforcaro
2021-10-03Kernel: Remove AK::String usage from Storage/IDEChannel.cppBrian Gianforcaro
2021-10-02Kernel: Make aarch64 UART::print_num() print u64sNico Weber
2021-10-02Kernel: Add a Timer class for aarch64Nico Weber
For now, this can only query microseconds since boot. Use this to print a timestamp every second. This busy-loops until a second has passed. This might be a good first use of interrupts soon. qemu used to not implement this timer at some point, but it seems to work fine even in qemu now (qemu v 5.2.0).
2021-10-02Kernel: Access Processor static methods staticallyBrian Gianforcaro
SonarCloud flagged this "Code Smell", where we are accessing these static methods as if they are instance methods. While it is technically possible, it is very confusing to read when you realize they are static functions.
2021-10-02Kernel: Access MemoryManager static functions staticallyBrian Gianforcaro
SonarCloud flagged this "Code Smell", where we are accessing these static methods as if they are instance methods. While it is technically possible, it is very confusing to read when you realize they are static functions.
2021-10-02Prekernel: Better datasheet link for RPi3Nico Weber
2021-10-01Kernel: Switch RTL8168NetworkAdapter::possible_device_name to StringViewBrian Gianforcaro
There is no need to allocate a `AK::String` for the device name, when the list of devices is entirely static.
2021-10-01Kernel: Convert network adapter names to Kernel::KStringBrian Gianforcaro
Another step of incremental progress of removing `AK::String` from the kernel, to harden against OOM.
2021-10-01Kernel: Move x86 IO instructions code into the x86 specific folderLiav A
2021-10-01Kernel: Remove IO.h include from a bunch of placesLiav A
2021-10-01Kernel: Fix a few typosNico Weber
2021-09-30Kernel: Exclude userspace heap memory from coredumps by defaultAndreas Kling
When a process with a large heap crashes (e.g WebContent), it gets very cumbersome to dump out a huge amount of memory. In the vast majority of cases, we're only interested in generating a nice backtrace from the coredump, so let's have the kernel skip over userspace heap regions when dumping memory for now. This is not ideal, and almost a little bit ugly, but it does make investigating 500 MiB WebContent crashes significantly easier for now.
2021-09-30Kernel: Make UART::print_num(0) work on aarch64Nico Weber
2021-09-30Kernel: Zero out .bss contents on aarch64Nico Weber
After building and running objcopy -O binary Build/aarch64/Kernel/Prekernel/Prekernel \ /media/sdcard/kernel8.img things start booting on an actual RPi4 :^) (Assuming the sdcard contains RPi firmware, an empty config.txt, and no other kernel*.img files).
2021-09-30Kernel: Implement getsockopt(SO_TYPE)Rodrigo Tobar
This is easy to implement, and is required by some applications like python's ssl module.
2021-09-29Kernel/PCI: Remove all macros and replace them with enum classesLiav A
2021-09-29Kernel/PCI: Remove Address from enumeration callbackLiav A
If we need that address, we can always get it from the DeviceIdentifier.
2021-09-29Kernel/PCI: Cache interrupt line and interrupt pin of a deviceLiav A
This allows us to remove the PCI::get_interrupt_line API function. As a result, this removes a bunch of not so great patterns that we used to cache PCI interrupt line in many IRQHandler derived classes instead of just using interrupt_number method of IRQHandler class.
2021-09-29Kernel/PCI: Propagate usage of DeviceIdentifier everywhereLiav A
This allows us to remove a bunch of PCI API functions, and instead to leverage the cached data from DeviceIdentifier object in many places.
2021-09-29Kernel: Rename two PCI componentsLiav A
Rename ID => HardwareID, and PhysicalID => DeviceIdentifier. This change merely does that to clarify what these objects really are.
2021-09-29Kernel/PCI: Cache more details about PCI devices when enumerating themLiav A
There's no good reason to fetch these values each time we need them.
2021-09-28AK: Add missing AK/Types.h include to VirtIO/Protocol.hHendiadyoin1
How did this even work?
2021-09-27Kernel/Graphics: Modernize somewhat the code of BochsGraphicsAdapterLiav A
Reduce the amount of macros in favor to enum classes.
2021-09-27Kernel/Graphics: Ensure we set BGR format of bochs-display if supportedLiav A
Instead of blindly forcing BGR format on the bochs-display device, let's ensure we do that only on QEMU bochs-display and not on VirtualBox graphics adapter too.
2021-09-27Kernel/Graphics: Force BGR format when modesetting the bochs-displayLiav A
By default bochs-display uses the BGR format, but for future-proof solution, let's force it explicitly to use that format.
2021-09-27Kernel: Fix a typo in a commentNico Weber
2021-09-27Kernel: Adjust aarch64 linker scriptNico Weber
- .text now starts at 0x80000, where an actual (non-qemu) RPi expects - use magic section name ".text.first" to make sure the linker script puts the kernel entry point at the start of the .text section - remove a few things from the x86 linker script that aren't needed for aarch64 (yet?)
2021-09-27Kernel: Move prekernel linker.ld into Arch subdirectoriesNico Weber
This moves Kernel/Prekernel/linker.ld unchanged to Kernel/Prekernel/Arch/aarch64 and Kernel/Prekernel/Arch/x86. The aarch64 will change in a future commit. No behavior change.
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.