Commit graph

22752 commits

Author SHA1 Message Date
Daniel Bertalan 23d66fe719 AK: Add RETURNS_NONNULL attribute and use it
This attribute tells compilers that the pointer returned by a function
is never null, which lets it optimize away null checks in some places.
This seems like a nice addition to `NonnullOwnPtr` and `NonnullRefPtr`.

Using this attribute causes extra UBSan checks to be emitted. To offset
its performance loss, some additional methods were marked ALWAYS_INLINE,
which lets the compiler optimize duplicate checks
2021-06-29 22:57:52 +04:30
Daniel Bertalan 65b2d3add3 Shell: Don't do null check on NonnullRefPtr<T>
This will cause a problem when `NonnullRefPtr<T>::operator T*` will be
declared as RETURNS_NONNULL. Clang emits a warning for this pointless
null check, which breaks CI.
2021-06-29 22:57:52 +04:30
Daniel Bertalan 754ddda38a Documentation: Document changes to creating smart pointers
Because of the added complexity of *non-throwing* `new`, helper methods
for correctly constructing smart pointers were added in a previous
commit. This commit changes the documentation to recommend using these,
and adds examples to aid in correctly determining when to use
non-throwing new when manually creating smart pointers.
2021-06-29 22:57:52 +04:30
Gunnar Beutner a5b4b95a76 Kernel: Report correct architecture for uname() 2021-06-29 20:03:36 +02:00
Gunnar Beutner 85561feb40 Kernel: Rename some variables to arch-independent names 2021-06-29 20:03:36 +02:00
Gunnar Beutner 2016354c12 Kernel+LibCoreDump: Implement more x86_64 coredump functionality 2021-06-29 20:03:36 +02:00
Gunnar Beutner d3127efc01 LibELF: Implement PLT relocations for x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner 1d4ae9194e LibC: Fix struct layout for sys_dirent on x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner 90e3aa35ef Kernel: Fix correct argument order for userspace entry point 2021-06-29 20:03:36 +02:00
Gunnar Beutner 449d34a154 Meta: Change default GDB layout
This adds a TUI window that displays disassembly/source code which
I've found quite useful.
2021-06-29 20:03:36 +02:00
Gunnar Beutner 0b82c583e0 Kernel: Implement capturing stack traces on x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner 6dde7dac8f Kernel: Implement signal handling for x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner 36ce2a2b76 Kernel: Fix struct layout for interrupt entries on x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner 5afec84cc2 LibELF: Add stub for R_X86_64_TPOFF64 2021-06-29 20:03:36 +02:00
Gunnar Beutner df9e73de25 Kernel: Add x86_64 support for fork() 2021-06-29 20:03:36 +02:00
Gunnar Beutner 811f9d562d LibELF: Make sure the mmap() regions are large enough
Sometimes we'd end up requesting a smaller range for .text and .data
than was actually necessary.
2021-06-29 20:03:36 +02:00
Gunnar Beutner 2eb025b2ea LibELF: Use correct accessor macros on x86_64 for some ELF fields 2021-06-29 20:03:36 +02:00
Gunnar Beutner c81d959afb LibELF: Implement GNU hash section lookups for x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner d138424549 DynamicLoader: Implement self relocations for x86_64 2021-06-29 20:03:36 +02:00
Idan Horowitz 3cfe1a8914 LibJS: Support the radix argument in BigInt.prototype.toString 2021-06-29 16:55:54 +01:00
Idan Horowitz 005d75656e LibCrypto: Replace from_base{2,8,10,16}() & to_base10 with from_base(N)
This allows us to support parsing and serializing BigIntegers to and
from any base N (such that 2 <= N <= 36).
2021-06-29 16:55:54 +01:00
Idan Horowitz a768131720 AK: Ensure StringBuilder capacity in String::reverse 2021-06-29 16:55:54 +01:00
Idan Horowitz 4a2a084789 AK: Add the to_ascii_base36_digit helper method 2021-06-29 16:55:54 +01:00
Idan Horowitz 12e66de410 LibJS: Check the target function of a bound function in is_constructor
This is not exactly compliant with the specification, but our current
bound function implementation isn't either, so its not currently
possible to implement it the way the specification requires.
2021-06-29 16:03:21 +01:00
Idan Horowitz 1d94d7a367 LibJS: Make Array.of(...items) generic
As well as bring it generally closer to the specification.
2021-06-29 16:03:21 +01:00
kleines Filmröllchen 7ff363127b Toolchain: Allow containerized work with Serenity via Docker
Docker is a nice way of doing build automation, or just
containerizing builds for increased safety and isolating unstable
packages. The old Dockerfile in the toolchain did not satisfy these
needs. The new Dockerfile is known to run successfully on Docker
version 20.10.7. It clones the SerenityOS repo and builds the
toolchain. In this way, it is intended to be a starting point for other
Docker images that can e.g. run builds. For example, one can simply run
this docker image as-is, exec a shell in it and run a build there.
2021-06-29 15:56:02 +02:00
Andreas Kling 3ecd1d603f Assistant: Add subtitle field to the Result class
This allows providers to specify an appropriate subtitle instead of
making that something the UI layer has to figure out. :^)
2021-06-29 13:23:51 +02:00
Max Wipfli ed2bf0a753 AK: Use [[nodiscard]] in JsonObject and JsonArray 2021-06-29 13:18:03 +02:00
Max Wipfli 9c8a2a5f69 AK+Spreadsheet+LibWeb: Remove JsonObject::get_or()
This removes JsonObject::get_or(), which is inefficient because it has
to copy the returned value. It was only used in a few cases, some of
which resulted in copying JsonObjects, which can become quite large.
2021-06-29 13:18:03 +02:00
Max Wipfli e82611bb87 AK: Add JsonObject::has_* methods
This adds methods to JsonObject to check if a key exists with a certain
type. This simplifies code that validates whether a JsonObject has the
expected structure.
2021-06-29 13:18:03 +02:00
Max Wipfli f45273649f AK+Everywhere: Change int to size_t in JsonObject and JsonArray 2021-06-29 13:18:03 +02:00
Max Wipfli 66526cbbaf AK: Return const& from JsonObject::get()
This adds a static JsonValue* s_null_value, which allows
JsonObject::get to return a reference instaed of copying the return
value. Since JsonValue is only 16 bytes, this seems like a reasonable
compromise.
2021-06-29 13:18:03 +02:00
Max Wipfli e0ed160372 AK: Use OrderedHashMap in JsonObject
This changes JsonObject to use the new OrderedHashMap instead of an
extra vector for tracking the insertion order.

This also adds a default value for the KeyTraits template argument in
OrderedHashMap. Furthermore, it fixes two cases where code iterating
over a JsonObject relied on the value argument being copied before
invoking the callback.
2021-06-29 13:18:03 +02:00
Max Wipfli 13b2067da6 AK: Make JsonValue::as_string_or() const 2021-06-29 13:18:03 +02:00
Max Wipfli 53480180cb AK: Use east const style in Json{Array,Object}.h 2021-06-29 13:18:03 +02:00
Andreas Kling 9179a2ea73 Assistant: Fix crash when activating empty search result
If there are no search results in the list, we shouldn't do anything
when you try to active the selected result, since there isn't one.

Fix this by using an Optional<size_t> to store the selected index.
2021-06-29 13:08:21 +02:00
Andreas Kling bec2b3086c LibGUI: Don't fire on_change hook at start of TextEditor::paint_event()
If something happens in response to on_change that causes the widget
to get unparented, creating a GUI::Painter will fail since it can't
find the window to paint into.

Since painting only cares about the syntax highlighting spans, what we
really want is to ensure that spans are up-to-date before we start
painting.

The problem was that rehighlighting and the on_change hook were bundled
together in an awkward lazy update mechanism. This patch fixes that by
decoupling rehighlighting and on_change. Rehighlighting is now lazy
and only happens when we handle either paint or mouse events. :^)

Fixes #8302.
2021-06-29 11:22:57 +02:00
Andreas Kling 114e8fffcd LibELF: Don't validate PT_LOAD alignment in ET_CORE files
This was causing CrashDaemon to choke on our coredumps. Note that we
didn't care about the validation failures before this change either,
this patch simply reorders the checks to avoid divide-by-zero when
validating an ET_CORE file.
2021-06-29 10:43:58 +02:00
Diego Garza c37ad5a1d3 LibC: Add struct keyword to FBRects.rects to make it C compiler safe 2021-06-29 10:04:29 +02:00
Tom 85bb13e081 WindowServer: Fix animations not triggering rendering
When starting the first animation and while animations are ongoing we
need to make sure we trigger rendering.
2021-06-29 10:03:53 +02:00
Andrew Kaster ab88f4e082 Base: Set UBSAN to deadly for TestRunner service
This will run all the tests that are children of this service with
deadly UBSAN, ensuring we don't get any UBSAN regressions in on-target
tests anymore. :^)
2021-06-29 07:17:34 +04:30
Andrew Kaster 882002c566 LibSantizer: Read $UBSAN_OPTIONS to set deadliness on first print
The first time we want to print a UBSAN violation, the UBSAN runtime
in userspace will get the UBSAN_OPTIONS environment variable to check if
it contains the string "halt_on_error=1". This is clearly not robust to
invalid options or adding more options, but it gets the job done at the
moment. :^)
2021-06-29 07:17:34 +04:30
Andrew Kaster 97444f0a25 LibCrypto: Avoid unaligned reads in GHash constructor
The fact that this always reads 16 bytes from the input byte stream
for the key data is still a bit on the suspicious side, but at least
it won't crash UBSAN anymore.
2021-06-29 07:17:34 +04:30
Ali Mohammad Pur 3058ff1500 LibHTTP: Relax the finish_up() "must be called once" limitation a bit
It's alright for this function to be called multiple times, as it quits
early when a partial flush doesn't empty the download buffer.
Relax the assertion to having scheduled "did_finish()" only once.
2021-06-29 01:57:16 +04:30
Erik Sommer b12e5de047 WindowServer: Change animation time to duration
The time interval for animations is most often described as `duration`
in animation contexts and the `WindowServer::Animation` class
should reflect that.
2021-06-28 22:29:39 +02:00
Gunnar Beutner 0cb937416b Meta: Install 64-bit libgcc_s.so for x86_64 targets 2021-06-28 22:29:28 +02:00
Gunnar Beutner 086b7a4537 LibC: Implement memcpy and memset for x86_64 2021-06-28 22:29:28 +02:00
Gunnar Beutner 2a78bf8596 Kernel: Fix the return type for syscalls
The Process::Handler type has KResultOr<FlatPtr> as its return type.
Using a different return type with an equally-sized template parameter
sort of works but breaks once that condition is no longer true, e.g.
for KResultOr<int> on x86_64.

Ideally the syscall handlers would also take FlatPtrs as their args
so we can get rid of the reinterpret_cast for the function pointer
but I didn't quite feel like cleaning that up as well.
2021-06-28 22:29:28 +02:00
Gunnar Beutner b6435372cc Kernel: Implement syscall entry for x86_64 2021-06-28 22:29:28 +02:00
Gunnar Beutner 732dc72c58 Kernel: Fix the limit for the IDT table 2021-06-28 22:29:28 +02:00