Commit graph

8891 commits

Author SHA1 Message Date
Timothy Flynn
02fae575ca LibWeb: Define a helper constant for the platform ctrl-ish key
For all intents and purposes, the cmd (super) key on macOS should be
treated as the ctrl key.

(cherry picked from commit 71b25e3e5a70937f1e2031b94541c04a68d28efa;
amended to fix minor conflict)
2024-11-26 16:03:32 -05:00
Sönke Holz
d523ea93d6 Kernel/aarch64: Don't use u32 for PageDirectory.h definitions
VMSAv8-64 translation descriptors are 64-bit.
2024-11-24 23:34:53 +01:00
implicitfield
9d6ef8989d Prekernel/CMake: Remove a stale BYPRODUCTS entry
This rule hasn't actually generated a `Prekernel` file since d068af89,
so this wasn't doing anything other than causing this target to be
re-ran all the time.
2024-11-23 23:50:17 -05:00
implicitfield
175f9dc5c3 LibC: Symlink headers into the sysroot at configure-time
This removes the need to have the install_libc_headers target, since
LibC's headers will now get installed before anything gets built. By
extension, this also prevents said target from re-running on every
build.
2024-11-23 23:50:17 -05:00
Sönke Holz
b6d7cf10e5 Kernel/aarch64: Use MM APIs for MMIO
This causes serial output to stop working before MM is completely
initialized, as MMIO is not usable before that.
2024-11-23 19:29:50 +01:00
Sönke Holz
fd395e5705 Kernel/MM: Only return true in is_initialized if completely initialized 2024-11-23 19:29:50 +01:00
Sönke Holz
dc045cf670 Prekernel: Remove the Pentium M PAE force enable quirk
We don't support i686 anymore.
2024-11-23 19:29:50 +01:00
Sönke Holz
c12c58d771 Kernel/aarch64: Add MemoryType support 2024-11-23 19:29:50 +01:00
Sönke Holz
071ac0b94f Kernel/x86: Remove a FIXME from PageDirectory.h
Yes, the page table entry format is very arch-specific.

This FIXME was added during initial aarch64 bringup.
2024-11-23 19:29:50 +01:00
Sönke Holz
3791da53b3 Kernel/MM: Remove Page{Directory,Table}::{is,set}_write_through
We never used this attribute, so remove it.
If we ever find a use for it, we should enable it with a new MemoryType
'WriteThrough' instead.
2024-11-23 19:29:50 +01:00
Sönke Holz
b3bae90e71 Kernel/x86: Set the WC PAT memory type for MemoryType::NonCacheable
This removes the old Region::set_write_combine function and replaces
all usages of it with setting the MemoryType to NonCacheable instead.
2024-11-23 19:29:50 +01:00
Sönke Holz
d3a0ae5c57 Kernel/MM: Replace Region::Cacheable with a more generic MemoryType enum
This replaces all usages of Cacheable::Yes with MemoryType::Normal and
Cacheable::No with either MemoryType::NonCacheable or MemoryType::IO,
depending on the context.

The Page{Directory,Table}::set_cache_disabled function therefore also
has been replaced with a more appropriate set_memory_type_function.
Adding a memory_type "getter" would not be as easy, as some
architectures may not support all memory types, so getting the memory
type again may be a lossy conversion. The is_cache_disabled function
was never used, so just simply remove it altogether.

There is no difference between MemoryType::NonCacheable and
MemoryType::IO on x86 for now.

Other architectures currently don't respect the MemoryType at all.
2024-11-23 19:29:50 +01:00
Sönke Holz
a60e6d2f5d Kernel/GPU: Make the ContiguousFramebufferConsole region non-cacheable
Framebuffers should never be cached.
2024-11-23 19:29:50 +01:00
Sönke Holz
8e54c6c97f Kernel/AHCI: Add missing Cacheable::No to cmd table region allocation
The other allocations of the AHCI Command Table in this file already had
that argument.
2024-11-23 19:29:50 +01:00
Sönke Holz
038cf3cc5c Kernel/MM: Make MMIO regions non-cacheable by default
Most MMIO regions should not be cacheable, as MMIO accesses
typically have side effects (and are therefore not idempotent).
2024-11-23 19:29:50 +01:00
Sönke Holz
ad312d57c6 Kernel/MM: Remove unnecessary 'Memory::' from some function signatures
The 'Memory::' prefixes looked out of place next to the other region
allocation functions.
2024-11-23 19:29:50 +01:00
Sönke Holz
d56cedf3cd Kernel/aarch64: Use generic kprintf.cpp 2024-11-23 19:29:50 +01:00
implicitfield
b765ee22d3 Kernel/FATFS: Fix a typo 2024-11-20 20:47:46 -05:00
implicitfield
70f29d064f Kernel/FATFS: Use last() and take_last() where possible 2024-11-20 20:47:46 -05:00
implicitfield
423e80d22f Kernel/FATFS: Handle the "." and ".." entries correctly in remove_child 2024-11-20 20:47:46 -05:00
implicitfield
c74ee7d36a Kernel/FATFS: Fill in first cluster metadata for new ".." entries 2024-11-20 20:47:46 -05:00
implicitfield
b83be2b754 Kernel/FATFS: Fix an off-by-one in create_sfn_from_lfn
With this change, we no longer crash after finding more than one period
in a filename.
2024-11-20 20:47:46 -05:00
implicitfield
ce871de432 Kernel/FATFS: Abstract out SFN helpers and make them usable in userspace 2024-11-20 20:47:46 -05:00
Sönke Holz
61244cdad5 Kernel/EFI: Add header for the RISC-V EFI boot protocol
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
5772348b99 Kernel/EFI: Add header for the "Media Access" protocols
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
05b4e38ed0 Kernel/EFI: Add header for the "Loaded Image" protocols
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
83adb406a5 Kernel/EFI: Add header for the "Device Path" protocols
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
7cd62197da Kernel/EFI: Add header for the System Table
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
4a9480e7a9 Kernel/EFI: Add header for the Boot Services
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
fbce9ec8cc Kernel/EFI: Add header for the "Console Support" protocols
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
1ac9aaa6ac Kernel/EFI: Add header for basic EFI data types
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
7c710805ec Kernel: VERIFY that the SafeMem sections are not empty on all arches 2024-11-07 09:32:54 -05:00
Sönke Holz
9e9148dead Kernel/aarch64: Add .{ro,unmap}_after_init sections to linker script 2024-11-07 09:32:54 -05:00
Sönke Holz
859fceeb07 Kernel/aarch64: Correctly set {start,end}_of_kernel_{data,text}
MemoryManager::protect_kernel_image uses these symbols.
2024-11-07 09:32:54 -05:00
Sönke Holz
93cc7d213f Kernel/x86: Fix indentation in linker script 2024-11-07 09:32:54 -05:00
Sönke Holz
3f3f7a4440 Kernel/aarch64: Fix indentation in linker script
Also remove some trailing whitespace.
2024-11-07 09:32:54 -05:00
Sönke Holz
1d9301d845 Kernel/aarch64: Don't use the memory before .text as the initial stack
This new stack has the same size as the initial stack on riscv64 and
x86_64.
2024-11-07 09:32:54 -05:00
implicitfield
54bfc3d294 Kernel/Ext2FS: Cache blocks less aggressively
With this patch, we now only cache at most 2^14 blocks, which greatly
relieves memory pressure when working with large files.
2024-11-05 20:14:21 +01:00
implicitfield
54b8fe1fa4 Kernel/Ext2FS: Add a helper to free every block an inode holds 2024-11-05 20:14:21 +01:00
implicitfield
a32b9c903b Kernel/Ext2FS: Make block allocation properly fallible
For some context, write_bytes_locked used to simply bail out before
writing any data if there weren't enough blocks to cover the entire size
of an inode before 1bf7f99a.

We're not actually restoring that behavior here, since computing the
amount of blocks to be allocated would get exceedingly complex,
considering that there could always be holes in between already
allocated blocks.

Instead, this simply makes allocate_blocks() bail out properly if there
aren't any free blocks left.

Fixes #24980
2024-11-05 20:14:21 +01:00
implicitfield
dca1a755c2 Kernel/FATFS: Make lookups case-insensitive 2024-11-02 15:54:29 -04:00
implicitfield
a9083f9be7 Kernel/FATFS: Avoid creating LFN entries when an SFN will suffice 2024-11-02 15:54:29 -04:00
implicitfield
0ba7a03869 Kernel/FATFS: Implement the specced LFN -> SFN conversion algorithm 2024-11-02 15:54:29 -04:00
implicitfield
3a585fa5a2 Kernel/FATFS: Keep all FATs up to date
There are almost always at least two FATs, so let's make sure to keep
all of them up to date.
2024-11-02 15:54:29 -04:00
implicitfield
b8828c7629 Kernel/FATFS: Cap reads at the respective file size 2024-11-02 15:54:29 -04:00
Sönke Holz
d6a3500973 Kernel/aarch64: Make RPi::Timer a DeviceTree::Driver
This driver doesn't actually get any info (like the physical address)
from the devicetree node for now.
2024-11-02 13:53:10 -04:00
Sönke Holz
ed6202601b Kernel/aarch64: Make RPi::InterruptController a DeviceTree::Driver
This driver doesn't actually get any info (like the physical address)
from the devicetree node for now.
2024-11-02 13:53:10 -04:00
Sönke Holz
9f47b4b490 Kernel: Introduce a new model for writing devicetree drivers
Devicetree drivers are created by using the `DEVICETREE_DRIVER` macro.
That macro creates a new class deriving from `DeviceTree::Driver` and
inserts it into the driver init section.
The driver code then has to implement the `probe` member function, which
will be called if `DeviceTree::Management` finds a node with a
compatible property entry that was in the array passed as the second
argument to the `DEVICETREE_DRIVER` macro.
The `probe` function then will check if it supports the given node and
if so, registers a `DeviceTree::DeviceRecipe` at the appropriate
subsystem, which will then create a device from that recipe once it is
initialized.
The driver can store the necessary info it got from the devicetree,
such as the physical address and interrupt numbers, in the capture
list of the callback lambda stored in `DeviceRecipe::create_device`.

The `DeviceTree::DeviceRecipe`s are necessary, as the `probe` functions
might not be able to create an instance of the actual device class,
since doing so can depend on some subsystems being initialized first.
2024-11-02 13:53:10 -04:00
Sönke Holz
19258d8980 Kernel/USB: Let register_driver work before USBManagement initialization
This will be needed in the next commit, which moves the driver init
functions calling code earlier into the boot process.
2024-11-02 13:53:10 -04:00
Sönke Holz
eacfb94256 Kernel: Rename pre_init arguments to fit the new BootInfo definition 2024-10-30 18:51:35 -04:00