Commit graph

59137 commits

Author SHA1 Message Date
Hendiadyoin1
38cb5444d9 AK: Make StringView::for_each_split_view() aware of IterationDecision 2024-02-24 16:43:44 -07:00
Sönke Holz
1fc0c84017 Kernel/riscv64: Implement Processor::assume_context
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
726865592c Kernel/riscv64: Implement Processor::switch_context
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
494e026ca7 Kernel/riscv64: Implement Processor::init_context
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
efdc433ebc Kernel/riscv64: Implement thread_context_first_enter
thread_context_first_enter reuses the context restoring code in the
trap handler, just like other arches already do.

The `ld x2, 1*8(sp)` is unnecessary in the trap handler, as the stack
pointer should be equal to the stack pointer slot in the RegisterState
if the trap is from supervisor mode (and we currently don't support
user traps).
This load will however make us unable to reuse that code for
thread_context_first_enter.
2024-02-24 16:42:58 -07:00
Sönke Holz
7fbcceb657 Kernel/riscv64: Implement enter_thread_context
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
2f33e7a964 Kernel/riscv64: Stub out Processor::set_thread_specific_data 2024-02-24 16:42:58 -07:00
Sönke Holz
7fff6eef09 Kernel/riscv64: Implement Processor::initialize_context_switching
This code is based on the aarch64 implementation.
2024-02-24 16:42:58 -07:00
Sönke Holz
1429c83942 Kernel/riscv64: Implement {load,store}_fpu_state
This commit adds two functions which save/restore the entire FPU state.
On RISC-V, you only need to save the floating pointer registers
themselves and the fcsr CSR, which contains the entire state of the F/D
extensions.
2024-02-24 16:42:58 -07:00
Sönke Holz
cd389833d4 Kernel/riscv64: Use TimeManagement as an entropy source for now
Better entropy will require us to parse the riscv,isa devicetree
property and then use the Zkr extension, if present.
2024-02-24 16:37:20 -07:00
Sönke Holz
f6151b3c9e Kernel/Storage: Add AssertSizes to AHCI structs 2024-02-24 16:36:47 -07:00
Sönke Holz
f85099ea47 Kernel/Storage: Make AHCI::HBA::port_regs a flexible array member
Some real hardware apparently uses smaller BAR sizes than sizeof(HBA)
with a completely filled port_regs member.
Change the port_regs array to a flexible array member, so we don't panic
while verifying that the BAR size is large enough to map this struct.
Accesses to this array are already bounds checked against
AHCI::Limits::MaxPorts.
2024-02-24 16:36:47 -07:00
Sönke Holz
6fd02d2a04 Kernel: Add PCI::map_bar overloads that don't take an explicit size
These overloads map the entire BAR space instead.
2024-02-24 16:36:47 -07:00
Bastiaan van der Plaat
089a98607c LibWeb: Add HTMLPreElement width property 2024-02-24 16:35:11 -07:00
Hugh Davenport
2e8ff1855c Browser: Allow system shortcuts to function
Before shortcuts like ALT-F4, etc did not work. This makes the window
ignore keydown events. In the future this may be altered to allow for
custom shortcuts from within ladybird?
2024-02-24 16:30:50 -07:00
Lucas CHOLLET
cb03ab4a5a LibPDF: Handle the BlackIs1 parameter of the CCITTFaxDecode Filter 2024-02-24 16:24:45 -07:00
Lucas CHOLLET
6b3bab5c8a LibPDF: Plug in the CCITTFaxDecode filter to our CCITT decoder
We only call the decoder for Group 4 images. We do support Group 3
images, but let's wait to find a PDF with these before adding support.
2024-02-24 16:24:45 -07:00
Ilya Hanov
a16f0e9053 Meta: Prevent "serenity.sh gdb" to close other tmux sessions
"Meta/serenity.sh gdb" command opens tmux and
creates windows for GDB and emulator's logs.

The problem is that while it uses "trap" to close
just opened tmux session once debugging
is finished, it will close previously
opened session as well due to "trap" is
setup twice.

This commit tries to prevent touching
other tmux session.
2024-02-24 16:21:45 -07:00
Sönke Holz
0b0ea19d12 LibELF+readelf: Add support for RISC-V dynamic relocation types 2024-02-24 16:05:50 -07:00
Sönke Holz
f8628f94b8 LibELF: Refactor how arch-specific dynamic relocation types are handled
We currently expect that the relocation type numbers are unique across
all architectures. But RISC-V and x86_64 use the same numbers for
different relocation types (R_X86_64_COPY = R_RISCV_JUMP_SLOT = 5).

So create a generic reloc type enum which maps to the arch-specific
reloc types instead of checking for all arch reloc types individually
everywhere.
2024-02-24 16:05:50 -07:00
Liav A
c216e7439f Kernel: Require StorageDevice reference for StorageDevicePartition
Allowing creation of StorageDevicePartition objects for any arbitrary
BlockDevice objects means that we could technically create a
StorageDevicePartition for another StorageDevicePartition which is
obviously not the intention for this code. Instead, require to pass a
StorageDevice reference to ensure this cannot happen.
2024-02-24 16:01:26 -07:00
Liav A
f08f339e9a Kernel: Return EIO if attached device is gone in StorageDevicePartition
The previous code will just do a nullptr-dereference if the underlying
device is gone, so instead gracefully return EIO error.
2024-02-24 16:01:26 -07:00
Liav A
67e028e4f4 Kernel: Declare proper blocking support for StorageDevicePartitions 2024-02-24 16:01:26 -07:00
Liav A
42ed0a6c94 Kernel/Storage: Rename DiskPartition => StorageDevicePartition
We deal with partitions for storage devices, not only for disk devices,
originally harddrives.
2024-02-24 16:01:26 -07:00
Liav A
4e651d0e4f Kernel/Storage: Convert StorageDevice class members to be const
It is expected that these class members will be set when the object is
created (so they're set in the class constructor method) and never
change again, as its the driver responsibility to find these values
before creating a StorageDevice object.

This makes it easier to rely on these values later on as we don't expect
them to ever change for a StorageDevice object during its lifetime.
2024-02-24 16:01:26 -07:00
Liav A
c8bdcd90a8 Kernel/Storage: Fix StorageDevice STORAGE_DEVICE_GET_SIZE ioctl option
It calculated the disk size with the zero-based max addressable block
value.
For example, for a disk device with a block size of 512 bytes that has 2
LBAs so it can address LBA 0 and LBA 1 (so m_max_addressable_block is 1)
the calculated disk size will be 512 instead of 1024 bytes.
2024-02-24 16:01:26 -07:00
Liav A
763ef690c6 Kernel/Storage: Declare proper blocking support for StorageDevices
We remove can_read() and can_write(), as both of these methods should be
implemented for proper blocking support.
For our case, the previous code will simply block the user if they tries
to read beyond the max addressable offset, which is not a correct
behavior.

Instead, just do proper EOF guarding when calling read() and write() on
such objects.
2024-02-24 16:01:26 -07:00
Liav A
c33246235a Kernel/Storage: Change semantics for addressing block methods
Add a method for matehmatical operations when verifying IO operation
boundaries.
Also, make max_addressable_block method non-virtual, since no other
derived class actually has ever overrided this method.
2024-02-24 16:01:26 -07:00
Tim Ledbetter
f3a68fc80d mktemp: Ensure --tmpdir and template paths are concatenated correctly
Previously, using the `--tempdir` option with a template containing a
path didn't work correctly, as the template path would be discarded.
2024-02-24 15:57:14 -07:00
implicitfield
84252db976 Utilities: Add mkfs.fat
This adds a basic `mkfs.fat` utility, which can format FAT12, FAT16
and FAT32 partitions.

This does have a few limitations, namely in that FAT12 formatting is
limited to a set known floppy disk sizes, and we can only generate
512-byte sectors.
2024-02-24 15:54:52 -07:00
implicitfield
a69e113d49 Kernel: Add a definition for the FAT32 FSInfo structure 2024-02-24 15:54:52 -07:00
implicitfield
8b77737f8e Kernel: Move FAT structure definitions to Kernel/API
We need to be able to include these definitions from userspace as the
upcoming mkfs.fat utility will depend on these.
2024-02-24 15:54:52 -07:00
implicitfield
f2503b2048 CMake: Allow the names of utilities to contain extensions
Previously, we would remove the "longest extension" from each file name
when parsing it as the name of a utility, which made it impossible for
the names of utilities to contain any extensions.
2024-02-24 15:54:52 -07:00
implicitfield
8384bb138e LibFileSystem: Add a helper to get the size of a block device 2024-02-24 15:54:52 -07:00
implicitfield
a70d79ff98 LibFileSystem: Add a helper to get the file size from fstat 2024-02-24 15:54:52 -07:00
implicitfield
896f213c6f LibFileSystem+Userland: Rename size() to size_from_stat()
This reflects what the functions does more accurately, and allows for
adding functions to get sizes through other methods.

This also corrects the return type of said function, as size_t may only
hold sizes up to 4GB on 32-bit platforms.
2024-02-24 15:54:52 -07:00
implicitfield
d3c6e31bf3 CMake: Build lagom with -D_FILE_OFFSET_BITS=64 on Linux
32-bit glibc limits off_t to 32 bits without this definition, which
makes working with large files rather difficult.
2024-02-24 15:54:52 -07:00
Tom Finet
a7db718ffb Kernel/Net: Send RST packet when socket receives in closed state
RFC9293 states that a closed socket should reply to all non-RST
packets with an RST. This change implements this behaviour as
specified in section 3.5.2 in bullet point 1.
2024-02-24 15:49:46 -07:00
Fabian Dellwing
29ef508b4e tail: Collapse repeated error handling into statement expression
Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2024-02-24 15:48:36 -07:00
Fabian Dellwing
e40aca2d77 tail: Handle truncation in follow mode 2024-02-24 15:48:36 -07:00
Fabian Dellwing
5180e41918 Kernel: Call did_modify_contents() after truncate()
Truncating a file should absolutly mark it as modified. With this
change our `tail` implementation can correctly handle it.
2024-02-24 15:48:36 -07:00
Sönke Holz
525555181e LibELF: Add riscv64 PLT trampoline
This code is based on the aarch64 implementation.
2024-02-24 15:41:23 -07:00
Julian Offenhäuser
bf9240c7a9 Ports: Update OpenRCT2 to version 0.4.8 2024-02-24 23:26:26 +01:00
Dan Klishch
8ac0e3f0e5 AK+LibJS: Remove null state from DeprecatedFlyString :^) 2024-02-24 15:06:52 -07:00
Dan Klishch
026c1caba0 LibJS: Don't use null DFS for binding_name parameters in ClassExpression 2024-02-24 15:06:52 -07:00
Dan Klishch
d558468d03 LibJS: Don't differentiate between empty and null DFS in CatchClause 2024-02-24 15:06:52 -07:00
Dan Klishch
fb2c929310 LibJS: Don't use null DFS in {Import,Export}Entry 2024-02-24 15:06:52 -07:00
Dan Klishch
78491204d9 LibJS: Don't use null DFS for break/continue statements without a label 2024-02-24 15:06:52 -07:00
Dan Klishch
761d16141d LibJS: Store DFS instead of opaque StringImpl inside StringOrSymbol
Additionally, use the second bit (instead of the first) to differentiate
between strings and symbols there. This will allow transparent
conversion of DFS to StringBase in the future.
2024-02-24 15:06:52 -07:00
Dan Klishch
a53911717f LibJS: Remove DeprecatedFlyString::impl use in PrimitiveString 2024-02-24 15:06:52 -07:00