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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Previously, it ignored 'start', sorting from the array's
beginning. This caused unintended changes and slower
performance. Fix ensures sorting stays within 'start'
and 'end' indices only.
(cherry picked from commit 356016c626546aeb51722fe9ca5bb6a769bfe762)
The CenterRight and TopCenter alignment cases were
mistakenly identical due to a copy-paste error,
causing the function to behave unexpectedly.
Rather than attempting to fix it, remove aligned_within entirely.
(cherry picked from commit 116e7baeada1184bb10c64aed3cd20315955c63a)
This PL011 driver doesn't have any RPi-specific code anymore.
Also change the documentation references to refer to the generic PL011
manual instead and adapt some register definitions.
Some definitions were previously named unused/unsupported. They were
mostly related to some hardware flow control lines and IrDA which the Pi
UARTs don't support.
This required making the `debug_output` console configurable at runtime
by introducing a `DebugConsole` struct, which simply contains a callback
for printing a single character.
We should probably use something like this abstraction for all
architectures in the future.
This new abstraction provides a simple solution for handling early
driver initialization without requiring some kind of dependency
management for devicetree drivers, which would otherwise be necessary.