Commit graph

64546 commits

Author SHA1 Message Date
Sönke Holz
aa4c286138 Kernel/aarch64: Make RPi::SDHostController a DeviceTree::Driver 2024-12-19 12:53:52 -05:00
Sönke Holz
cae52e39c2 Kernel/aarch64: Only attempt to initialize the MiniUART on Raspberry Pis 2024-12-19 12:53:52 -05:00
djwisdom
05ccc4ccf5 Ports: Update jakt to latest as of 19-Dec-2024 2024-12-18 20:33:41 -05:00
Sönke Holz
e447342550 Kernel/aarch64: Perform an ISB after setting TTBR*_EL1
Changes to ARM system registers are not guaranteed to be visible until
a context synchronization event, like performing an ISB.
2024-12-19 00:29:05 +01:00
Sönke Holz
1d3a255ea1 Kernel: Recognize a stack pointer pointing to the top of stack as valid
This also removes the explicit decrementing of the stack pointer in
`sys$create_thread` before passing it to `validate_user_stack`,
as it's unnecessary now.
2024-12-18 16:09:52 -05:00
Sönke Holz
a6be79d977 WindowServer: Handle shifted submenus during safe submenu navigation
The old calculation was unnecessarily complicated and didn't handle
horizontally or vertically shifted menus correctly.

To determine the two triangle corners at the submenu, we can simply
use the submenu's rect() and subtract the position of the parent menu
to get the correct relative coordinates.
This fixes the case when the menu is shifted vertically.

If the submenu is shifted horizontally, we need to use the opposite
corners of the window rect.
2024-12-17 19:05:49 -05:00
MacDue
df59b54a45 LibGfx: Add "Redmond Glass" window theme
This adds a window theme that aims to imitate the default Windows 7
theme (known as Aero). This initial version mainly focuses on window
frames along with minor taskbar theming.

Currently, the colors for the window frames are hardcoded, but the
actual gradient painting uses the LibGfx gradient support, so it should
be fairly easy to make configurable.
2024-12-17 19:04:58 -05:00
MacDue
0531955673 LibGfx: Add "Redmond Plastic" window theme
This adds a window theme that aims to imitate the default Windows XP
theme (known as Luna). This initial version mainly focuses on window
frames along with minor taskbar theming.

Currently, the colors for the window frames are hardcoded, but the
actual gradient painting uses the LibGfx gradient support, so it should
be fairly easy to make configurable.
2024-12-17 19:04:58 -05:00
MacDue
b34fb8e7f9 LibGfx+Taskbar: Allow having an alpha channel for the taskbar window 2024-12-17 19:04:58 -05:00
MacDue
893f7ed1d6 LibGfx: Avoid overpainting in Painter::draw_line()
These axis-aligned cases can be done with a single fill call too (which
is likely faster).
2024-12-17 19:04:58 -05:00
MacDue
a205b57b20 LibGfx: Avoid overpainting in Painter::draw_rect_with_thickness() 2024-12-17 19:04:58 -05:00
MacDue
47400d5b06 Taskbar: Fill inside of task bar frames (clock and applet area)
This does not change anything for the classic theme but will be needed
to ensure things look okay with more custom taskbar themes.
2024-12-17 19:04:58 -05:00
MacDue
759e29fdae LibGfx+Taskbar: Add paint hooks for the taskbar to WindowTheme
This will allow window themes to apply (basic) customization to the
taskbar.
2024-12-17 19:04:58 -05:00
MacDue
94f06cdd33 LibGfx+WindowServer: Allow specifying a window theme in the palette
Currently, the only available option is "Classic", but in later patches
this will be used to allow selecting custom window themes (e.g. for
Aero or Luna styles).

It is a little weird that this is in the palette, but it already
contains non-color properties, and placing the window themes here makes
them easily accessible when needed.
2024-12-17 19:04:58 -05:00
MacDue
23385968ca WindowServer: Clear format when resetting MultiScaleBitmaps 2024-12-17 19:04:58 -05:00
implicitfield
8ed7225810 Kernel/VFS: Don't explicitly remove "." and ".." entries
No behavior change intended.
2024-12-17 19:02:15 -05:00
implicitfield
0e94887b2c Kernel/VFS: Make filesystem implementations responsible for renames
Previously, the VFS layer would try to handle renames more-or-less by
itself, which really only worked for ext2, and even that was only due to
the replace_child kludge existing specifically for this purpose. This
never worked properly for FATFS, since the VFS layer effectively
depended on filesystems having some kind of reference-counting for
inodes, which is something that simply doesn't exist on any FAT variant
we support.

To resolve various issues with the existing scheme, this commit makes
filesystem implementations themselves responsible for the actual rename
operation, while keeping all the existing validation inside the VFS
layer. The only intended behavior change here is that rename operations
should actually properly work on FATFS.
2024-12-17 19:02:15 -05:00
implicitfield
666ba3b970 Kernel/Ext2FS: Make to_ext2_file_type a static member of Ext2FSInode 2024-12-17 19:02:15 -05:00
implicitfield
14d216e819 mv: Prefer FileSystem::remove over unlink when moving across filesystems
unlink doesn't handle directories, while FileSystem::remove does.
2024-12-17 19:02:15 -05:00
implicitfield
4148716671 LibFileSystem: Ignore ENOTSUP from chmod and chown in copy_directory
This was missed in 5e87b789.
2024-12-17 19:02:15 -05:00
implicitfield
8db6dd47c7 Kernel/FATFS: Allocate new entries properly in allocate_entries
There were two separate issues at play which made this work incorrectly.
The first was that the newly allocated block was incorrectly computed,
because it was assumed that the cached block list was updated when a new
cluster was allocated. The second issue was that there was an off-by-one
in the loop that collected the newly allocated entries, which meant that
the resulting list had an entry less than what was requested.
2024-12-17 19:02:15 -05:00
implicitfield
1a4036e8ed Kernel/FATFS: Don't shadow lfn_entries in add_child 2024-12-17 19:02:15 -05:00
implicitfield
c6e483d65e Kernel/FATFS: Make (an overload of) first_cluster actually freestanding
The old overload still depended on m_entry being initialized, which
meant that (due to where this method is used) all inodes ended up
getting the same index.
2024-12-17 19:02:15 -05:00
Zaki
1a82f0f422 Ports: Update readline to version 8.2.13 2024-12-17 19:01:43 -05:00
Sönke Holz
070534c3ee LibC: Don't push a fake return address in create_thread on non-x86
The AArch64 and RISC-V ABI use a caller-saved register to store the
return address instead of (always) storing it on the stack.
All non-special registers of newly created threads are zero by default,
so we don't need to anything special for those architectures here.

This change also causes the stack pointer to no longer be misaligned for
secondary threads on those architectures.
2024-12-17 19:01:05 -05:00
Linus Groh
5db1ddc677 Meta: Ignore title length of revert commits
Even if a commit message title previously fit into the 72 character
limit it may go over that with 'Revert ""' added - asking the author to
tweak the commit message is not appropriate in that case.

Since additional context can be added to the commit message body the
usual length restriction applies to the remaining lines.

Also restructure the code to group checks based on the line number we're
currently looking at.
2024-12-16 22:08:51 +01:00
Sönke Holz
7bcf97c8e8 Kernel/aarch64: Implement microseconds_delay
This simple delay loop uses the EL1 virtual timer to wait for the given
amount of time.
2024-12-15 15:26:40 +01:00
Sönke Holz
6517eabb5f Kernel/aarch64: Rename AUX.{h,cpp} to AUXPeripherals.{h,cpp}
The file name "AUX" is reserved on Windows.
2024-12-15 02:06:23 +01:00
Sönke Holz
b88cd185a0 Kernel/aarch64: Use the EL1 virtual timer for ARMv8Timer
The physical timer might not be accessible to us if we are running in a
hypervisor.
2024-12-14 19:40:02 +01:00
Sönke Holz
4cc9bea86d Kernel/aarch64: Reject ARMv8Timers with the "interrupt-names" property
Our current check `interrupts.size() != 4` doesn't always work because
timers with the "interrupt-names" property can define 4 timers at the
same indices mapping to different interrupts.

The old devicetree binding only allowed 4 interrupts, so keep the old
check as well.
2024-12-14 19:40:02 +01:00
implicitfield
98f26fac1b Kernel/AHCI: Don't use [[gnu::packed]] on register structs
The AHCI specification accounts for common alignment rules, so we don't
actually need to pack these structs. In fact, packing some of these
structs actually causes misaligned accesses on aarch64.
2024-12-14 18:18:02 +01:00
implicitfield
b5491e58f1 Kernel/aarch64: Implement interrupt reservation 2024-12-14 18:18:02 +01:00
implicitfield
7fb4396cba Kernel/aarch64: Initialize interrupts during processor bringup 2024-12-14 18:18:02 +01:00
implicitfield
47114b11e8 Kernel/aarch64: Share the PCI initialization routine with RISC-V 2024-12-14 18:18:02 +01:00
Sönke Holz
056cba3c0c Kernel: Use MemoryType::IO for DMA regions everywhere
Drivers using DMA buffers are currently broken on bare metal since
d3a0ae5c57 and b3bae90e71 made DMA buffers use the NonCacheable memory
type.

We should investigate each of these drivers and and add proper fences
where needed.

The only place where MemoryType::IO definitely isn't needed is the xHCI
scratchpad regions, as they are only accessed by the device.
2024-12-12 16:07:25 +01:00
Sönke Holz
10c217070f Kernel/MM: Allow setting the memory type for DMA regions 2024-12-12 16:07:25 +01:00
Sönke Holz
0d6d716e94 Kernel/aarch64: Add ARMv8Timer support
This timer is used by the Raspberry Pi 3+4 and the QEMU virt machine.

Remove the `#if ARCH`s from HardwareTimerType, as all other enum values
would otherwise have to be updated to keep the values consistent across
all architectures.
2024-12-12 15:06:28 +01:00
Sönke Holz
ebe5b0df03 Kernel/aarch64: Add GICv2 support
GICs are used by many ARM systems, including the Pi 4+5 and the QEMU
virt machine.
2024-12-12 15:06:28 +01:00
Sönke Holz
27ff852387 Kernel/aarch64: Support more than 64 interrupts
GICv2s can have up to 1020 interrupts.

AArch64 IRQControllers previously returned a bit field of pending
interrupts. Change the API to return one pending interrupt at a time
instead.

We still truncate the interrupt number to 8 bit in a lot of other places
in the kernel. This is something that needs to be addressed in a future
commit.
2024-12-12 15:06:28 +01:00
Sönke Holz
f33f7f91de Kernel: Handle devicetree drivers with multiple compatible strings 2024-12-12 15:06:28 +01:00
Sönke Holz
300c132f47 Kernel/USB: Remove never-initialized USB::Device::m_{vendor,product}_id
These members were never set and are redundant because you can just read
them directly from the device descriptor.
2024-12-11 18:57:54 -05:00
Zhaoming Luo
d126092002 Kernel/x86_64: Fix the number in a comment in RTC 2024-12-11 20:11:11 +01:00
Sönke Holz
a3af84c5e6 Kernel/aarch64: Get RPi timer address and IRQ number from the devicetree 2024-12-10 16:25:46 +01:00
Sönke Holz
0eec585596 Kernel/aarch64: Get RPi interrupt controller address from the devicetree 2024-12-10 16:25:46 +01:00
Sönke Holz
053d1cb79c Kernel: Add a helper to get devicetree resources 2024-12-10 16:25:46 +01:00
Sönke Holz
5aa6136e02 LibDeviceTree: Add functions for accessing common interrupt properties 2024-12-10 16:25:46 +01:00
Sönke Holz
ddd9ab21e6 LibDeviceTree: Add functions for getting and translating addresses
I created this test file by running the following command:

    dtc -o address-translation.dtb <<EOF
    /dts-v1/;

    / {
        compatible = "serenity,address-translation-test";
        #address-cells = <2>;
        #size-cells = <1>;

        soc {
            compatible = "simple-bus";
            #address-cells = <1>;
            #size-cells = <1>;
            ranges = <0xa0000000 0xfe 0xd0000000 0x40000000>;

            usb@a0010000 {
                reg = <0xa0010000 0x100000>;
            };

            some-bus@b0000000 {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <2>;
                ranges = <0x02 0x00 0xb0000000 0x00 0x200000>;

                leds@200100000 {
                    reg = <0x02 0x100000 0x00 0x1000>;
                };
            };
        };
    };
    EOF
2024-12-10 16:25:46 +01:00
Sönke Holz
7d41d5191b LibDeviceTree: Rename DeviceTreeNodeView to Node
The class is in the DeviceTree namespace, so the prefix is redundant.
Calling it a 'View' is also somewhat misleading, as it is not simply a
cheap-to-copy reference to the underlying memory but is instead marked
as AK_MAKE_NONCOPYABLE.
2024-12-10 16:25:46 +01:00
Sönke Holz
81ede84131 LibDeviceTree: Rename DeviceTreeProperty to Property
The struct is in the DeviceTree namespace, so the prefix is redundant.
2024-12-10 16:25:46 +01:00
Sönke Holz
ed097d87da LibDeviceTree: Make FlattenedDeviceTreeTokenType an enum class
This will be necessary in the next commit to avoid a name conflict.
2024-12-10 16:25:46 +01:00