status = "okay" means the device is operational. We should ignore
devices that have a different status property value.
The BCM2835TimerDriver force disable hack can be removed, since that
timer is disabled in the Pi 4 devicetree.
But we have to introduce another hack that force enables the Pi 3 system
timer, as we otherwise wouldn't have any timer that we support for the
Pi 3.
Make the MemoryType used by mmap() configurable by
File::vmobject_and_memory_type_for_mmap overrides (previously called
vmobject_for_mmap).
All mmap()s were previously MemoryType::Normal.
Some assembly files were previously inconsistently formatted.
- Use 4 spaces for indentation
- Use `.L` as the local label prefix
- Remove trailing whitespace
We don't have any text relocations in the kernel anymore.
This linker argument was added in bd6dc5ccec as a temporary workaround.
Removing this argument won't cause text relocations to be reported for
aarch64 and riscv64, as we currently compile the kernel with `--no-pie`
on those architectures.
This pseudoinstruction causes text relocations, as it stores the target
address in literal pools inside .text.
The bss clearing code now also matches the RISC-V implementation.
`handle_crash` already calls `dump_registers`, so there is no need for
the AArch64 exception handler to do it as well.
The second register dump (the one made by `handle_crash`) previously
also often reported an incorrect ESR_EL1 value, as interrupts are
enabled at that point in time.
This problem can simply be solved by saving the ESR_EL1 value in the
`RegisterState`, similar to how we save `scause` on RISC-V.
The initial value we used for SCLTR_EL1 would allow EL0 to do things it
shouldn't be allowed to, like disabling interrupts.
Setting that register to more permissive values and overriding it later
shouldn't cause any problems, but it's still less confusing this way.
Immutable mounts are mounts that can't be changed in any aspect, if the
VFSRootContext that hold them is used by a process. This includes two
operations on a mount:
1. Trying to remove the mount from the mount table.
2. Trying to change the flags of the mount.
The condition of a VFSRootContext being held by a process or not is
crucial, as the intention is to allow removal of mounts that marked as
immutable if the VFSRootContext is not being used anymore (for example,
if the container that was created with such context stopped).
Marking mounts as immutable on the first VFS root context essentially
ensures they will never be modified because there will be a process
using that context (which is the "main" VFS root context in the system
runtime).
It should be noted that setting a mount as immutable can be done in
creation time of the mount by passing the MS_IMMUTABLE flag, or by doing
a remount with MS_IMMUTABLE flag.
Not all processors provide a mechanism to read the cycle count.
Change the `EntropySource::add_random_event` function to fall back to
getting a timestamp from TimeManagement if no cycle count is available.
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.
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.
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.