Commit graph

30673 commits

Author SHA1 Message Date
James Mintram 34709c8d39 Kernel: Rename Aarch64Registers -> Registers and add Aarch64 namespace 2021-11-28 22:01:21 -08:00
James Mintram 271b9b8da3 Kernel: Set up and activate the MMU in the aarch64 perkernel 2021-11-28 22:01:21 -08:00
James Mintram c2d7e200eb Kernel: Move common aarch64 asm functions into kernel folder and NS 2021-11-28 22:01:21 -08:00
James Mintram 68b5d00f42 Kernel: Split prekernel exception level code into its own file 2021-11-28 22:01:21 -08:00
James Mintram 18f1530c84 Kernel: Change prekernel to use shared SP across Exception Levels 2021-11-28 22:01:21 -08:00
James Mintram 5a75bd31b0 Kernel: Replace inline asm with typesafe static member functions 2021-11-28 22:01:21 -08:00
James Mintram 4bc5936a57 Kernel: Remove unused header from Aarch64_asm_utils 2021-11-28 22:01:21 -08:00
Andreas Kling ddce053f6c LibIPC: Replace u32/u64 value coders with u/ul/ull value coders
We can and should do more cleanups of this kind, but this is a quick fix
to unbreak the 32-bit HackStudio build.
2021-11-29 02:45:27 +01:00
Andreas Kling 16746efcf8 SpiceAgent: Port to LibMain :^) 2021-11-28 23:14:19 +01:00
Andreas Kling 83056efc1a LibCore: Add syscall wrapper for dup() 2021-11-28 23:14:19 +01:00
Andreas Kling cb9cac4e40 LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void>
This allows us to use TRY() in decoding helpers, leading to a nice
reduction in line count.
2021-11-28 23:14:19 +01:00
Andreas Kling 8d76eb773f LibIPC: Make IPC::Connection::post_message() return ErrorOr 2021-11-28 23:14:18 +01:00
Andreas Kling 982ac34437 LibCore: Add syscall wrappers for sendfd() and recvfd() 2021-11-28 23:14:18 +01:00
Andreas Kling 86a3ef2709 LibIPC: Give MessageBuffer::fds some inline capacity (1)
This dodges a heap allocation when sending 0 or 1 fd across the IPC
boundary (which covers every message.)
2021-11-28 23:14:18 +01:00
kleines Filmröllchen 8608cd11e4 LibAudio: Optimize sample moves in FlacLoader
As long as possible, entire decoded frame sample vectors are moved into
the output vector, leading to up to 20% speedups by avoiding memmoves on
take_first.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 295eec2d49 AK: Stop Vector::extend from unnecessary reallocation
Previously, Vector::extend for a moved vector would move the other
vector into this vector if this vector was empty, thereby throwing away
existing allocated capacity. Therefore, this commit allows the move to
only happen if this vector's capacity is too small to fit the other
vector. This will also alleviate bugs where callers relied on the
capacity to never shrink with calls to unchecked_append, extend and the
like.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 05cb499d58 AK: Add Vector::unchecked_append for data pointers
This mirrors the existence of append() for data pointers and is very
useful when the program needs to have a guarantee of no allocations,
as is necessary for real-time audio.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 9c40311622 Utilites: Add abench utility
abench (audio benchmark) is an audio benchmarking utility that allows
testing decoder performance.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 96d02a3e75 LibAudio: New error propagation API in Loader and Buffer
Previously, a libc-like out-of-line error information was used in the
loader and its plugins. Now, all functions that may fail to do their job
return some sort of Result. The universally-used error type ist the new
LoaderError, which can contain information about the general error
category (such as file format, I/O, unimplemented features), an error
description, and location information, such as file index or sample
index.

Additionally, the loader plugins try to do as little work as possible in
their constructors. Right after being constructed, a user should call
initialize() and check the errors returned from there. (This is done
transparently by Loader itself.) If a constructor caused an error, the
call to initialize should check and return it immediately.

This opportunity was used to rework a lot of the internal error
propagation in both loader classes, especially FlacLoader. Therefore, a
couple of other refactorings may have sneaked in as well.

The adoption of LibAudio users is minimal. Piano's adoption is not
important, as the code will receive major refactoring in the near future
anyways. SoundPlayer's adoption is also less important, as changes to
refactor it are in the works as well. aplay's adoption is the best and
may serve as an example for other users. It also includes new buffering
behavior.

Buffer also gets some attention, making it OOM-safe and thereby also
propagating its errors to the user.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen ec8bd8116d LibAudio: Buffer API improvements
This consists of two changes: First, a utility function create_empty
allows the user to quickly create an empty buffer. Second, most creation
functions now return a NonnullRefPtr, as their failure causes a VERIFY
crash anyways.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 14d330faba LibAudio: Avoid frequent read() calls in FLAC residual decode
Decoding the residual in FLAC subframes is by far the most I/O-heavy
operation in FLAC decoding, as the residual data makes up the majority
of subframe data in LPC subframes. As the residual consists of many
Rice-encoded numbers with different bit sizes for differently large
numbers, the residual decoder frequently reads only one or two bytes at
a time. As we use a normal FileInputStream, that directly translates to
many calls to the read() syscall. We can see that the I/O overhead while
FLAC decoding is quite large, and much time is spent in the read()
syscall's kernel code.

This is optimized by using a Buffered<FileInputStream> instead, leading
to 4K blocks being read at once and a large reduction in I/O overhead.

Benchmarking with the new abench utility gives a 15-20% speedup on
identical files, usually pushing FLAC decoding to 10-15x realtime speed
on common sample rates.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen cbb2b4fe71 AK: Expose Buffered's buffer size and underlying stream 2021-11-28 13:33:51 -08:00
Hendiadyoin1 6f74c1bb11 AK: Allow to "get a result" from Result<void>
This is to make Result<void> work inside TRY
2021-11-28 13:33:51 -08:00
Ben Wiederhake b1982267b2 AK: Remove unused static member of Bitmap
This is a remnant of the Bitmap/BitmapView split.
2021-11-28 13:16:41 -08:00
Ben Wiederhake 7ba7668fbb Meta: Allow overlong 'fixup!' commit titles in pre-commit hook 2021-11-28 11:49:13 -08:00
Marcus Nilsson 5217202737 ThemeEditor: Use LibMain
Use the new serenity_main construct and TRY in ThemeEditor.
2021-11-28 10:10:35 -08:00
Marcus Nilsson c91eebfbaa Magnifier: Use LibMain
Use the new serenity_main construct and TRY in Magnifier.
2021-11-28 10:10:35 -08:00
Stephan Unverwerth cbf93ee687 LibGL: Initialize all GL context matrices with the identity matrix 2021-11-28 10:07:34 -08:00
Daniel Bertalan 36bd230ffa Toolchain/Clang: Fix CMake using utilities from the LLVM port
If we have the LLVM port installed, CMake might pick up some of the
tools installed as part of it (`llvm-ar`, `llvm-strip`, etc.) instead of
the ones belonging to the host toolchain. These, of course, can't be run
on the host platform, so builds would eventually fail. This made it
impossible to rebuild the LLVM toolchain.

We now set these variables explicitly when compiling the LLVM runtime
libraries in order to avoid this issue.
2021-11-28 09:38:57 -08:00
Daniel Bertalan e88ca09609 Ports: Upgrade LLVM to version 13.0.0
With this update, we now use our custom `serenity` Clang target, which
means that all system-specific compilation options (e.g. default PIE,
header search paths) will be handled automatically.

This port has been tested to build `Source/little` on all 4
toolchain-architecture pairs. Furthermore, `lib(std)c++` headers are
picked up correctly and our AK headers can be included without any
issues.

Due to recent kernel fixes related to memory-mapped files, the LLD
linker can now be used by default, so there's no need to also build the
GCC port alongside this.

Although our patches cover building libLLVM as a shared library, this is
currently not enabled by default, as DynamicLoader is very slow in
dealing with such a large number of relocations.
2021-11-28 09:38:57 -08:00
Daniel Bertalan f29f9762a2 Meta: Copy libstdc++ into the disk image
With this, we can now compile C++ programs with the LLVM port without
having to jump through hooks to build libc++ because it can't be
cross-compiled with our GNU toolchain.
2021-11-28 09:38:57 -08:00
Daniel Bertalan c4707ed0d9 Meta: Copy libc++ headers into the disk image
If we do this, the LLVM port's Clang will pick up these paths, so we
won't have to compile libc++ twice. This does increase the size of
_disk_image by 5 MB, but that shouldn't be a problem.
2021-11-28 09:38:57 -08:00
Daniel Bertalan 87d548c520 LibC: Make SIZE_MAX be understood by the preprocessor
POSIX mandates that the macros contained in `stdint.h` be suitable for
use by the C preprocessor.

If we write `((size_t)-1)`, the C preprocessor will just skip the cast
and treat the value as `-1`. This means that we end up taking the wrong
branch in an `#if` directive like `#if SIZE_MAX > UINT32_MAX`.

This fixes building the LLVM port on i686.
2021-11-28 09:38:57 -08:00
Daniel Bertalan 23adb7449f LibC: Fix stdint.h macros on x86_64
x86_64 is an LP64 platform, so its `uint64_t` type is defined to be
`unsigned long`, not `unsigned long long` like on i686. This means that
the `UL` literal suffix should be used instead of `ULL`.

Furthermore, `uintptr_t` is 64 bits wide on x86_64, so defining
`UINTPTR_MAX` to be `UINT32_MAX` is also not correct.
2021-11-28 09:38:57 -08:00
Daniel Bertalan 4c0d868bb6 LibC: Add definition for ENOTRECOVERABLE
This is used by the LLVM port.
2021-11-28 09:38:57 -08:00
Daniel Bertalan b1f6bfca7f Toolchain/Clang: Support using libstdc++ as the C++ standard library
This will come in handy if we want to use the LLVM port with a GNU host
compiler.

As of version 13, libc++ uses `__attribute__((using_if_exists))` to
import global LibC functions into the `std` namespace, which allows some
symbols to be absent. GCC does not support this attribute, so it fails
to build libc++ due to some obscure `wchar.h` functions. This means that
cross-compiling libc++ is not possible; and on-target builds would be
tedious, so we'll be better off using the toolchain's `libstdc++`.
2021-11-28 09:38:57 -08:00
Daniel Bertalan ce3b219021 Toolchain/Clang: Allow setting a default unwind library
This will let us use `libgcc` for unwinding when we build the LLVM port
with the GNU toolchain.
2021-11-28 09:38:57 -08:00
Daniel Bertalan ea8335cda1 Toolchain/Clang: Pick up includes when running inside Serenity
The toolchain should work without setting `--sysroot` when we build
inside SerenityOS.
2021-11-28 09:38:57 -08:00
Daniel Bertalan 91546f42f3 Toolchain/Clang: Add support for -static-libstdc++
This option is already used by our GNU toolchain to avoid creating a
circular dependency between LibC and `lib(std)c++`.
2021-11-28 09:38:57 -08:00
Jelle Raaijmakers 497180a650 Kernel: Ignore AC97 non-completion interrupts
Fixes #11094
2021-11-28 19:26:22 +02:00
Jelle Raaijmakers 689ad0752c Kernel: Add AC97_DEBUG macro 2021-11-28 19:26:22 +02:00
Jelle Raaijmakers bb58f6ccab LibGL: Implement glScissor() 2021-11-28 09:20:58 -08:00
Sam Atkins 6dd2ebfe8e Kernel: Log when a process exits with an unlocked veil
This catches applications that make use of `unveil()`, but then do not
lock the veil with `unveil(nullptr, nullptr)`.
2021-11-28 09:16:37 -08:00
Lady Gegga 611062df55 Base: Add Lisu Supplement characters to font Katica Regular 10
11FB https://www.unicode.org/charts/PDF/U11FB0.pdf
2021-11-28 09:16:21 -08:00
Lady Gegga 4a24b99173 Base: Add Toto characters to font Katica Regular 10
1E290–1E2BF https://www.unicode.org/charts/PDF/U1E290.pdf
2021-11-28 09:16:21 -08:00
Ali Mohammad Pur 0652774783 Base: Add a test page for async functions + XMLHttpRequest 2021-11-28 13:28:01 +00:00
Ali Mohammad Pur ccf713bf23 LibJS: Spin the event loop while waiting for async completion in await 2021-11-28 13:28:01 +00:00
Linus Groh f7ba81ac52 LibJS: Implement parsing of TemporalDurationString 2021-11-28 10:32:28 +00:00
Andreas Kling 60c132d7d3 LibGUI: Move GUI::SettingsWindow setup out of the constructor
In order to propagate errors that occur during UI setup, we have to move
all that logic out of widget/window subclass constructors. This is a
first attempt at doing that, for GUI::SettingsWindow.
2021-11-28 08:54:22 +01:00
Andreas Kling 56c4f0aff5 LibGUI: Add fallible variants of the GUI::Layout add/insert APIs 2021-11-28 08:54:22 +01:00