Commit graph

37841 commits

Author SHA1 Message Date
Daniel Bertalan bcf124c07d LibC: Implement a faster memset routine for x86-64 in assembly
This commit addresses the following shortcomings of our current, simple
and elegant memset function:
- REP STOSB/STOSQ has considerable startup overhead, it's impractical to
  use for smaller sizes.
- Up until very recently, AMD CPUs didn't have support for "Enhanced REP
  MOVSB/STOSB", so it performed pretty poorly on them.

With this commit applied, I could measure a ~5% decrease in `test-js`'s
runtime when I used qemu's TCG backend. The implementation is based on
the following article from Microsoft:

https://msrc-blog.microsoft.com/2021/01/11/building-faster-amd64-memset-routines

Two versions of the routine are implemented: one that uses the ERMS
extension mentioned above, and one that performs plain SSE stores. The
version appropriate for the CPU is selected at load time using an IFUNC.
2022-05-01 12:42:01 +02:00
Daniel Bertalan 484f70fb43 readelf: Add printing for STT_GNU_IFUNC 2022-05-01 12:42:01 +02:00
Daniel Bertalan 7aca408993 LibELF: Fail gracefully when IFUNC resolver's object has textrels
.text sections of objects that contain textrels have to be writable
during the relocation procedure. Because of this, we would segfault if
we tried to execute IFUNC resolvers defined in them. Let's print a
meaningful error message instead.

Additionally, a warning is now printed when we load objects with
textrels, as in the future, additional security mitigations might
interfere with them being loaded.
2022-05-01 12:42:01 +02:00
Daniel Bertalan 08c459e495 LibELF: Add support for IFUNCs
IFUNC is a GNU extension to the ELF standard that allows a function to
have multiple implementations. A resolver function has to be called at
load time to choose the right one to use. The PLT will contain the entry
to the resolved function, so branching and more indirect jumps can be
avoided at run-time.

This mechanism is usually used when a routine can be made faster using
CPU features that are available in only some models, and a fallback
implementation has to exist for others.

We will use this feature to have two separate memset implementations for
CPUs with and without ERMS (Enhanced REP MOVSB/STOSB) support.
2022-05-01 12:42:01 +02:00
Daniel Bertalan 4d5965bd2c LibELF: Keep track of whether the PLT contains REL or RELA relocations 2022-05-01 12:42:01 +02:00
Daniel Bertalan ed5f110b40 LibELF: Perform .relr.dyn relocations before .rel.dyn
IFUNC resolvers depend on the resolved function's address having been
relocated by the time they are called. This means that relative
relocations have to be done first.

The linker is kind enough to put R_*_RELATIVE before R_*_IRELATIVE in
.rel.dyn, but .relr.dyn contains relative relocations too.
2022-05-01 12:42:01 +02:00
Andrew Kaster 435a263998 LibELF: Relax restriction on allowed values of EI_OSABI to allow GNU
This check is here to make sure we only try to load serenity binaries.
However, with -fprofile-instr-generate -fcoverage-mapping, clang
sets the EI_OSABI field to 3, for GNU. The instrumentation uses a lot of
retained COMDAT sections for coverage instrumentation that get the
SHF_GNU_RETAINED section header flag set on them, forcing llvm to set
the ABI to GNU.
2022-05-01 12:42:01 +02:00
Idan Horowitz 1a8b5ef80a LibJS: Stop fetching GlobalObject from target's realm in ArrayBuffer
A function object's realm is not necessarily non-null (like when called
via the Reflect API), so we can't blindly dereference it. Instead use
the object's own GlobalObject.
2022-04-30 21:55:39 +02:00
Idan Horowitz 9098257668 LibJS: Reject -00000 as extended year in Date parsing 2022-04-30 21:36:27 +02:00
Idan Horowitz 0399239e3f LibJS: Do not negate zero into negative zero in ToIntegerOrInfinity
When the input value was in the range of [-1, 0] we would incorrectly
negate the resulting integer, resulting in -0 instead of the expected 0
2022-04-30 21:35:16 +02:00
djwisdom 0083fb629b Base+Documentation: Add UsingFontEditor markdown file
Applied all document rewordings as stated for in the PRs
conversation section.
2022-04-30 19:13:17 +02:00
Idan Horowitz 7ac9900023 LibJS: Reorder parsing for TimeSpecWithOptionalTimeZoneNotAmbiguous
Because `TimeHour TimeZoneNumericUTCOffsetNotAmbiguous[opt]
TimeZoneBracketedAnnotation[opt]` can be a subset of
`TimeHourNotValidMonth TimeZone` we would not exhaust the whole input
in some cases, which would result in an incorrectly thrown exception.
2022-04-30 18:36:10 +02:00
brapru 0866a0cd1e Kernel+route: Support global routing table deletion 2022-04-30 16:24:33 +02:00
brapru 863c14c4f4 Kernel: Make Route's operator== overload const 2022-04-30 16:24:33 +02:00
djwisdom d83f2e2ea6 Base: SatoriMono10 Regular add glyphs to widen coverage
Box Drawing
2500-257F
https://www.unicode.org/charts/PDF/U2500.pdf
2022-04-30 16:24:07 +02:00
djwisdom f96c25db6a Base: SatoriMono10 Bold add glyphs to widen coverage
Box Drawing
2500-257F
https://www.unicode.org/charts/PDF/U2500.pdf
2022-04-30 16:24:07 +02:00
djwisdom ba1ea40bd7 Base: Ataraxia10 Light add glyphs to widen coverage
Box Drawing
2500-257F
https://www.unicode.org/charts/PDF/U2500.pdf
2022-04-30 16:24:07 +02:00
djwisdom b9fdc9daa4 Base: Ataraxia10 Bold add glyphs to widen coverage
Box Drawing
2500-257F
https://www.unicode.org/charts/PDF/U2500.pdf
2022-04-30 16:24:07 +02:00
Karol Kosek 249d34ec09 Base: Rename Estonian emoji flag code sequence to 'EE'
Previously, the Estonian flag used just a single E.
2022-04-30 16:23:58 +02:00
Lady Gegga 9cd6d225f9 Base: Add Adlam to Katica Regular 10
1E900-1E95F https://www.unicode.org/charts/PDF/U1E900.pdf
2022-04-30 16:22:48 +02:00
Lady Gegga 3e0f5d7ff9 Base: Add Bassa Vah to Katica Regular 10
16AD0-16AF5 https://www.unicode.org/charts/PDF/U16AD0.pdf
2022-04-30 16:22:48 +02:00
Tim Schumacher 139f903960 Ports: Set the correct prefix for libxml2
The prefix should apply both inside and outside the system. Having the
full host path there only confuses software that is built inside the
system, as well as other ports that prepend the host path themselves
additionally.
2022-04-30 16:22:40 +02:00
Tim Schumacher a212a741df LibC: Add all the POSIX_FADV_* constants 2022-04-30 16:22:40 +02:00
Kenneth Myhra 1cc69edc34 Ports: Remove no longer needed fnmatch.patch
We already have LibC/fnmatch.h with the necessary defines so these
patches are no longer needed.
2022-04-29 22:49:25 +02:00
Linus Groh 27793bf76c LibJS: Replace U+2212 MINUS SIGN with U+002D HYPHEN-MINUS
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/bbcd37b
2022-04-29 22:40:46 +02:00
Linus Groh df1f81ba90 LibJS: Add notes about lifetime of surrounding agent
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/54e4abc
2022-04-29 22:40:46 +02:00
Linus Groh 76a6bd0e75 LibJS: Fix numeric type confusion in GetEpochFromISOParts return value
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/2a59eac
2022-04-29 22:40:46 +02:00
Linus Groh 70593b7448 LibJS: Update for structured headers added to various Temporal AOs
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/e6a15a5
2022-04-29 22:40:46 +02:00
Linus Groh 9a3014c91a LibJS: Drop "integral part of" language
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6ec1608
2022-04-29 22:40:46 +02:00
Linus Groh cb33320814 LibJS: Fix one more instance of Number value / integer confusion
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/5b1b783
2022-04-29 22:40:46 +02:00
Linus Groh aac457755d LibJS: Define IsBuiltinCalendar in terms of AvailableCalendars
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/896b72d
2022-04-29 22:40:46 +02:00
Linus Groh 2499911898 LibJS: Rename DateFromFields to CalendarDateFromFields, etc
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/fd27b54
2022-04-29 22:40:46 +02:00
Andreas Kling a7f702a021 LibC: Implement posix_fadvise() (as a harmless no-op) 2022-04-29 22:01:30 +02:00
Andreas Kling 910532b8dc LibC: Add more _POSIX_FOO constants to unistd.h
Let's advertise more of our POSIX capabilities. :^)
2022-04-29 22:01:27 +02:00
Andreas Kling 577b4c73b0 LibC: Add MIN, MAX and howmany macros to sys/param.h 2022-04-29 22:01:27 +02:00
Tim Schumacher 89f9454785 LibC: Actually set the FPU environment instead of its pointer 2022-04-29 22:01:06 +02:00
Linus Groh 7bf4a785c6 LibJS: Fix RoundNumberToIncrement spec number 2022-04-29 21:52:30 +02:00
Sam Atkins c57410358a ThemeEditor: Show if modified, and prompt before discarding unsaved work 2022-04-29 20:06:39 +02:00
Sam Atkins eaf24d2fce ThemeEditor: Update displayed alignment when loading a theme file 2022-04-29 20:06:39 +02:00
Sam Atkins eb76751a76 ThemeEditor: Stop firing unnecessary change callbacks
We only need to fire these callbacks when we want to change the palette.
So, when setting widget values to match a palette that has just been
loaded, or to show the value of the role selected in a ComboBox, we can
skip the callbacks. This saves some work, and means we can reliably use
on_palette_change to know when the palette has actually been modified.
2022-04-29 20:06:39 +02:00
Sam Atkins 6c572006a3 LibGUI+ThemeEditor: Split preview-widget palette-change callback
There are two different things in ThemeEditor that want to know when a
palette changes:
1. The PreviewWidget subclass, so it can update its preview.
2. The ThemeEditor itself, so we know that the palette is modified.

Using a protected virtual function for 1 means that we can do 2 without
them fighting over the same on_palette_change callback.
2022-04-29 20:06:39 +02:00
Sam Atkins 5fd0140772 LibGUI: Add AllowCallback parameter to ColorInput::set_color()
The `TextEditor::on_change` callback now only fires if the user types in
the box, or `set_text()` is called with `AllowCallback::Yes`.
Previously that callback was what set `m_color`, so I've rearranged
things a little so that the color still updates regardless of what
source the color came from.
2022-04-29 20:06:39 +02:00
Sam Atkins 91230ff28d ThemeEditor: Open the FilePicker at the location in the path input
The kernel panic no longer occurs, so we can do this now. :^)
2022-04-29 20:06:39 +02:00
Sam Atkins e05d5df6aa ThemeEditor: Show a message box if saving fails 2022-04-29 20:06:39 +02:00
Sam Atkins e15427c5ba ThemeEditor: Propagate failure to create AlignmentModel
Also make the AlignmentValue struct private, and initialize the Vector
in one go instead of empending.
2022-04-29 20:06:39 +02:00
Peter Elliott 12c7b954e1 Kernel+WindowServer: Move setting tty graphical mode to Userspace
This will allow using the console tty and WindowServer regardless of
your kernel command line. Also this fixes a bug where, when booting in
text mode, the console was in graphical mode, and would not accept
input.
2022-04-29 19:52:32 +02:00
Peter Elliott 4b0be17c71 Kernel: Support userspace TTY graphics modesetting
This is a copy of linux's KDSETMODE/KDGETMODE console ioctl(2)
interface.
2022-04-29 19:52:32 +02:00
Linus Groh bc4a0baa8f LibJS: Remove outdated FIXMEs about required date_from_fields() options
The `options` parameter is no longer required by the function, so we can
stop passing in options as well where not required by the spec.
2022-04-29 19:50:41 +02:00
Jelle Raaijmakers a8949f4eca AK: Install generated Debug.h into /usr/include
Ports like SDL2 can depend on headers that try to include `Debug.h`.
2022-04-29 18:05:42 +02:00
Jelle Raaijmakers 15b0c38c0f Ports: Compile SDL2 against LibAudio 2022-04-29 18:05:42 +02:00