Commit graph

62640 commits

Author SHA1 Message Date
Sönke Holz
a9a63c0f7c CI: Build riscv64 in CI
Don't run any tests on riscv64 for now, since some tests still fail
(mostly due to missing generic AK/Math.h implementations).
2024-08-27 12:03:49 +02:00
Dan Klishch
3ead8e8f4f AK: Make workaround for broken coroutine type deduction more specific
This bug was fixed on GCC trunk.
2024-08-26 17:47:03 +02:00
MacDue
ba21a17b75 shot: Use "popup" window type for screenshot area selection
This allows the selection to appear above all normal window types
including the task bar.
2024-08-25 15:34:38 +01:00
Alec Murphy
d73bad14ea LibIMAP+Mail: Show unseen message count for mailboxes
This PR implements the standard behavior of displaying the mailbox name
and parenthesized unseen message count in bold when the unseen message
count is greater than zero.
2024-08-24 21:52:44 -04:00
A* Ulven
4ac1ad48a2 LibVT: Handle concealed ANSI escape codes 2024-08-24 12:38:35 -04:00
Alec Murphy
99b01816ad Base: Add poweroff alias to shellrc
Just a little QoL improvement for muscle memory :^)
2024-08-23 22:16:50 +02:00
Nico Weber
af0fe2374d Tests: Modernize TestDeflate a bit
- Use TRY_OR_FAIL() instead of MUST() in a few places
- Use for-each loop in two tests
- Use StringView literals instead of u8 arrays in a few places

No behavior change.
2024-08-23 14:54:37 -04:00
Lucas CHOLLET
3fc784c442 AK/FuzzyMatch: Return the best possible score in case of equality
This fixes cases where fuzzy matching would return a better score for
a different pattern than a needle perfectly matching the haystack.

As an example, when searching for "fire" in emojis, "Fire Engine" would
have scored 168, while "Fire" was giving only 160.
This patch makes the latter have the best possible score.
2024-08-23 14:14:05 -04:00
Lucas CHOLLET
79431198ac AK/FuzzyMatch: Const qualify a u8 pointer 2024-08-23 14:14:05 -04:00
Lucas CHOLLET
dff57085ef AK/FuzzyMatch: Remove unnecessary const qualifier
These variables are already `constexpr`.
2024-08-23 14:14:05 -04:00
Nico Weber
18c9afe0c2 Meta: Make unzip buildable on lagom
Useful for profiling deflate performance for enwik8.zip.
2024-08-23 14:10:37 -04:00
Dan Klishch
32a8ef390b LibCrypto: Make dummy authenticated text length 16 bytes in GCM
Some callers of this API needlessly provide very large output buffer
even when input is small. Since we throw away all authentication-related
information here anyway, let's make the buffer (that gets
authenticated!) as small as possible.
2024-08-22 11:55:11 +02:00
Marek Knápek
07a58d2707 LibCrypto: Implement AES by using x86 intrinsics 2024-08-21 08:19:35 -04:00
Sönke Holz
75ccee81be Kernel: Use the correct ip in the dispatch_signal debug output
The signal handler RegisterState is in 'regs', not 'm_regs'.
2024-08-21 08:17:17 -04:00
Sönke Holz
7b0553eb13 Kernel/x86: Add missing rcx + r11 clobber to Syscall::invoke with 4 args
The 4-arg version was missing those.
2024-08-21 08:17:17 -04:00
Sönke Holz
d9c098f103 Kernel/x86: Use iretq instead of sysretq for sys$sigreturn
Using sysretq clobbers rcx and r11 as this instruction loads the rip and
rflags from those registers. This is fine for normal syscalls.

Signal dispatching works like this:
The kernel makes userspace jump to the signal trampoline when a signal
is dispatched. That trampoline then executes the sigreturn syscall after
calling the signal handler to continue executing the code before the
signal was dispatched.

Since e71c320154 the sigreturn syscall is done via the syscall
instruction (and int 0x82 support was removed in the next commit),
which causes the kernel to currently use sysretq to return to userspace.
But signals can happen at any time, not just during syscalls, so the
sigreturn syscall shouldn't clobber the contents of those registers when
returning to userspace.
2024-08-21 08:17:17 -04:00
Lucas CHOLLET
b806c52bd3 ImageViewer: Set scaling mode's default value to "Box Sampling"
This provides a way better experience when visualizing images. At some
point, we should probably remove the option to control it from the GUI.
2024-08-21 07:38:52 -04:00
Rishan Thangaraj
f5cb280608 TextEditor: Port TextEditor to GML Compiler 2024-08-21 07:36:23 -04:00
Hendiadyoin1
f5d2671718 Kernel/USBMS: Query and use the Block Limits VPD page
This allows us to properly limit our block requests to the device's
capabilities, and choose more optimal block counts for I/O operations.
In theory, as Qemu  only advertises a block limit above our current
internal block size limit of u16::max and does not advertise any optimal
transfer lengths.
2024-08-20 22:06:51 -04:00
Hendiadyoin1
0d2e8ec96f Kernel/USBMS: Inquire and wait for the storage device to become ready
This is apparently what bootloaders do before using a USB storage device
so we should likely do so as well, especially when no BIOS is present,
like on riscv.

Co-Authored-By: Sönke Holz <sholz8530@gmail.com>
2024-08-20 22:06:51 -04:00
Hendiadyoin1
e3567969d4 Kernel/USBMS: Add and use a send_scsi_command helper
This makes sending commands less repetitive
2024-08-20 22:06:51 -04:00
Hendiadyoin1
0866adde12 Kernel/USB: Be a bit more const-correct with USB transfers 2024-08-20 22:06:51 -04:00
Sönke Holz
13e789a261 Kernel/riscv64: Verify the FDT magic before copying it 2024-08-20 21:52:12 -04:00
Hendiadyoin1
f74f80e13b Kernel/aarch64: Use the FDT to get the device/boot info
This removes the old hacky multiboot memory map and instead uses the
FDT to get the actual memory map.
2024-08-20 21:52:12 -04:00
Hendiadyoin1
55a22ad393 Kernel/aarch64: Save the device tree 2024-08-20 21:52:12 -04:00
Sönke Holz
77a44df92b Meta: Download and use the Raspberry Pi 3 devicetree for running in qemu 2024-08-20 21:52:12 -04:00
Sönke Holz
c990c85d52 Meta: Use the correct build directory environment variable in run.py 2024-08-20 21:52:12 -04:00
Hendiadyoin1
e0a177061e Kernel/Firmware+riscv64: Move devicetree handling to Firmware directory
This also adds a `verify_fdt` method which will be used in later commits
2024-08-20 21:52:12 -04:00
Sönke Holz
1ffb7afba7 Kernel/aarch64: Make the kernel bootable from any physical load address
Instead calculate the load offset at runtime.

The mapping of the initial stack is now done explicitly. It was
previously included in the 2 MiB-aligned kernel range.

We need to use kernel8.img now, as we no longer hard-code the physical
addresses of all sections in the linker script. QEMU would otherwise
try to load us at KERNEL_MAPPING_BASE.
2024-08-20 21:52:12 -04:00
Sönke Holz
ba27989da1 Kernel/aarch64: Use MM's virtual_to_low_physical for Mailbox::send_queue
This is slightly better than assuming that cutting off the high 32 bits
results in the physical address. This worked for now because the kernel
(and stack) is mapped at KERNEL_MAPPING_BASE + PHYSICAL_LOAD_ADDR and
KERNEL_MAPPING_BASE & 0xffff'ffff == 0.

The next commit will move the kernel to KERNEL_MAPPINGS_BASE + 0, so
we need to get the physical address in a slightly less hacky way.
2024-08-20 21:52:12 -04:00
Sönke Holz
194d9df34f Kernel/Memory: Handle devicetree memory nodes with more than one region 2024-08-20 21:52:12 -04:00
Sönke Holz
ab44530304 Kernel/Memory: Remove x86 LAPIC address hack
MM is now able to handle MMIO after our "highest_phyisical_address".
2024-08-20 21:52:12 -04:00
Sönke Holz
810f2e7f29 Kernel/aarch64: Include .bss* sections in the linker script 2024-08-20 21:52:12 -04:00
A* Ulven
e863ba629e Documentation: Correct fuse2fs instructions for Fedora
`fuse2fs` comes from the `e2fsprogs` package in Fedora.
https://src.fedoraproject.org/rpms/e2fsprogs
2024-08-20 21:48:29 -04:00
Nico Weber
5b15951518 Meta: Port recent changes to the GN build
59aaef08d9 LibMedia: Rename LibVideo to LibMedia
aa2f5df0a9 AK: Add a helper to detect which CPU features are supported
0bbf42bca7 LibJS: Introduce the CanonicalizeKeyedCollectionKey AO
e06d74c314 LibWeb: Give DOM Elements a CountersSet
07fe3e57c6 LibWeb: Implement CounterStyleValue
1bc896fa60 LibWeb: Implement counter-[increment,reset,set] properties
78a22f5098 LibWeb: Replace templated retarget function with a regul...
e4fa0e7f63 LibWeb: Implement fetch record from the fetch spec
a8c4f34bff LibWeb: Create separate DedicatedWorkerGlobalScope class

Also add Services to include_dirs for LibWeb. This is necessary
due to the <WebWorker/DedicatedWorkerHost.h> include added in #24870.
2024-08-20 21:45:17 -04:00
Nico Weber
a3258d4094 LibGfx/ICC: Tolerate v2 profiles with D65 PCS illuminant
They do happen in practice.

We might have to do more to do actual color conversions with
these profiles, but for now let's at least load them.

Fixes rendering of a few images in my thesis in LibPDF.
The images were created in OmniGraffle in 2008, then saved as
PDF, then converted to eps using LaTeX tooling.
2024-08-20 09:43:06 -04:00
Stanisław Wiśniewski
02fd9b7d02 LibCore: Use forward() instead of move() for forwarding reference
Caught by clang-tidy `bugprone-move-forwarding-reference`
2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
f2990eea94 LibCore: Include AK/NonnullOwnPtr.h in EventLoopImplementationUnix.h 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
50a7ec6fc9 LibCore: Close fd if we fail to create AnonymousBuffer 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
6a41a43d49 LibCore: Add fixme about handling possible fd leaks 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
0687e29695 LibCore: Create fd_close_guard before possibly failing on fcntl 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
ca4c402309 LibCore: Put destruction of posix_spawn_file_actions in ScopeGuard 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
1b486b8964 LibCore: Change return value of Command::create() to
...`ErrorOr<NonnullOwnPtr>` instead of `ErrorOr<OwnPtr>`

At every call site, after retrieving pointer from `ErrorOr` it is
dereferenced right away.
2024-08-20 09:12:50 -04:00
Alec Murphy
2a19fb5261 PDFViewer: Implement thumbnail previews
This PR adds thumbnail previews and navigation to PDFViewer :^)
2024-08-20 08:00:03 -04:00
Panagiotis "Ivory" Vasilopoulos
62b938b798 Documentation: Improve 'On ideologically motivated changes'
From my previous interactions with the Serenity community, it was clear
to me that this rule (for better or worse) was introduced by the author
that wanted to focus on the code and not let an open-source operating
system project be used as a 'political vehicle' and so as to not have
to possess a political science degree to operate the project thought to
be a technical exercise, like building a sandcastle.

For better or worse.

Unfortunately, the wording as-is can be interpreted as a dogwhistle
in the direction of "keep politics out of tech", which has been present
in communities like, as of recently, NixOS - and this seems to have
caused the problems that Serenity has been intentionally trying to
avoid.

It might also disregard cases of technical arguments, arguments
involving how people treat each other _within_ the community as well
as how to change the wording in documentation with the sole intent of
making the project more attractive to more contributors.

Given recent commits and governance changes, I decided to rewrite the
rule to make it more clear and encourage people to be "more excellent
to each other", while not compromising on what I see as the original
meaning.
2024-08-18 21:43:22 -04:00
Nico Weber
c10853ca89 LibGfx/PNGWriter: Change filter heuristic to match comment
We were computing abs(sum(signed_pixels)), while the comment says
that sum(abs(signed_pixels)) works well. Change the code to match
the comment. (While I did tweak this code recently, as far as I can
tell the code hasn't matched the comment from when it was originally
added.)

Using the benchmarking script and same inputs as in #24819, just changed
to write .png files with different --png-compression-level values:

    level 0: 390M -> 390M (no change)
    level 1:  83M ->  78M (6% smaller)
    level 2:  73M ->  69M (5.8% smaller at default compression level)
    level 3:  71M ->  67M (5.6% smaller)

Sizes as computed by `du -hAs`. (`-A` prints apparent size on macOS.
It's important to use that flag to get consistent results. On Linux,
this flag is spelled `-b` instead.)

The size of sunset_retro.png goes up a tiny bit, but but less than
0.4% at all sizes. At level 2, the size goes from 908K to 911K, for
example.

The size of Tests/LibGfx/test-inputs/jpg/big_image.jpg encoded as PNG
goes down by about 2.7%, but it's the 2.7% that gets us over an MB
boundary at levels 1 and 2. At level 1, from 14M to 13M; at level 2
from 13M to 12M. (Exact numbers: 14417809 bytes to 13429605 at level 1,
14076443 bytes to 13088791 at level 2.) For comparison, sips writes a
15M (15610049 bytes) file. So we were already writing a smaller file,
and now we're even better. (We need 778 ms at level 1 while
 sips needs 723ms. So it's a bit faster, but not a ton.)

The size of wow.apng goes from 606K to 584K (3.6% smaller).

Perf-wise, this is close to a wash. Worst case, it's maybe 2-3% slower,
but the numbers are pretty noisy, even with many repetitions in
`hyperfine`. I'm guessing `ministat` would claim that no significant
difference can be shown, but I haven't tried it. For example, for
sunset_retro.png at level 2, time goes from 179.3 ms ± 2.5 ms to
182.8 ms ± 1.9 ms, which would be a 2% slowdown. At level 0, where
the effect is relatively largest, it goes from 21.8 ms ± 0.7 ms to
22.6 ms ± 0.7 ms, a 3.6% slowdown (but with huge error bars).
For big_image.jpg level 1, time goes from 768.5 ms ± 8.4 ms to
777.9 ms ± 6.0 ms, 1.2% slower.
2024-08-17 11:03:29 -04:00
Nico Weber
b9a1eb1533 LibGfx/PNGWriter: Swap red and blue channel at write time
Previously, we were swapping red and blue before doing filtering.
The filters don't care about channel order, so instead only do
this when writing the PNG data.

In theory, this saves the work of channel swizzling when figuring
out which filter is best. In practice, it's perf-neutral:
swizzling is basically free. But it's still conceptually simpler.

No behavior change.
2024-08-17 11:03:29 -04:00
Sönke Holz
e7b8eed005 Kernel: Share Processor::capture_stack_trace() between architectures
This makes Processor::capture_stack_trace() work on all our
architectures. For this function to work on AArch64 and RISC-V, the
frame pointer has to be saved during context switches.

AArch64 and RISC-V don't support SMP yet, so the code for getting a
backtrace for processes running on other cores is guarded behind a
'#if ARCH(X86_64)'.
2024-08-16 16:01:19 -04:00
Sönke Holz
fa39086922 Kernel: Add ThreadRegisters::frame_pointer() accessors 2024-08-16 16:01:19 -04:00
Sönke Holz
c1dc55ec7c Kernel: Remove Processor::is_kernel_mode
This function was only used to verify that we are running in kernel
mode. But it is pretty much impossible that we will ever end up in
kernel code and actually are able to execute it in user mode. A lot of
stuff must go completely wrong to end up in such a situation.

Getting the current privilege level is also impossible on RISC-V by
design.
2024-08-16 15:58:27 -04:00