Commit graph

15311 commits

Author SHA1 Message Date
asynts 7e62ffbc6e AK+Format: Remove TypeErasedFormatParams& from format function. 2020-12-30 20:33:53 +01:00
Luke 865f5ed4f6 Kernel: Prevent sign bit extension when creating a PDPTE
When doing the cast to u64 on the page directory physical address,
the sign bit was being extended. This only beomes an issue when
crossing the 2 GiB boundary. At >= 2 GiB, the physical address
has the sign bit set. For example, 0x80000000.

This set all the reserved bits in the PDPTE, causing a GPF
when loading the PDPT pointer into CR3. The reserved bits are
presumably there to stop you writing out a physical address that
the CPU physically cannot handle, as the size of the reserved bits
is determined by the physical address width of the CPU.

This fixes this by casting to FlatPtr instead. I believe the sign
extension only happens when casting to a bigger type. I'm also using
FlatPtr because it's a pointer we're writing into the PDPTE.
sizeof(FlatPtr) will always be the same size as sizeof(void*).

This also now asserts that the physical address in the PDPTE is
within the max physical address the CPU supports. This is better
than getting a GPF, because CPU::handle_crash tries to do the same
operation that caused the GPF in the first place. That would cause
an infinite loop of GPFs until the stack was exhausted, causing a
triple fault.

As far as I know and tested, I believe we can now use the full 32-bit
physical range without crashing.

Fixes #4584. See that issue for the full debugging story.
2020-12-30 20:33:15 +01:00
Peter Nelson d014277973 Docs: Update WSL notes with some workarounds for known issues 2020-12-30 20:31:30 +01:00
Linus Groh b3da5835f2 Toolchain: Fix incorrect use of ENV{SERENITY_ARCH} in CMakeToolchain.txt
This was setting CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to
"ENV{SERENITY_ARCH}-pc-serenity-...", causing some ports to not build
properly.
2020-12-30 20:30:43 +01:00
Linus Groh 45f00ce38d CrashReporter: Show assertion message in backtrace, if any 2020-12-30 16:28:27 +01:00
Linus Groh efdbd778c2 LibC: Set "assertion" coredump metadata in __assertion_failed() 2020-12-30 16:28:27 +01:00
Linus Groh d84b96bddc Kernel: Embed a Metadata notes entry in coredumps 2020-12-30 16:28:27 +01:00
Linus Groh 91332515a6 Kernel: Add sys$set_coredump_metadata() syscall
This can be used by applications to store information (key/value pairs)
likely useful for debugging, which will then be embedded in the coredump.
2020-12-30 16:28:27 +01:00
Linus Groh 7413a7c509 LibELF+LibCoreDump: Add a Metadata notes entry
This is a new NotesEntry type which will allow applications to embed
arbitrary metadata in crashdumps (stored as a JSON string). It will be
used to store an assertion message, for example.
2020-12-30 16:28:27 +01:00
Andreas Kling aa941a31ed LibGUI: Make SpinBox up/down buttons look right when disabled 2020-12-30 16:13:38 +01:00
Andreas Kling 0c7f3296e3 WidgetGallery: Tweak UI layout for "Modals" tab 2020-12-30 16:13:38 +01:00
Andreas Kling 26abb691d8 LibGUI: Make disabled scrollbars have more disabled looking icons
Draw a threed drop highlight under the arrows on disabled scrollbars.
This makes it more visible that they are disabled.
2020-12-30 16:13:38 +01:00
Morc - Richard Gráčik d32c845652 Terminal: Fix bell mode in Terminal Settings 2020-12-30 15:22:14 +01:00
Andreas Kling 9f5eb49407 WebContent: Pledge "recvfd" :^)
This is needed so we can receive file descriptors from ProtocolServer.

Fixes #4660.
2020-12-30 15:21:29 +01:00
Andreas Kling 1215d2a642 LibGUI: Make GUI::ScrollBar inherit from AbstractSlider 2020-12-30 15:20:47 +01:00
Andreas Kling cb67264f61 LibGUI: Rename AbstractSlider::on_value_changed => on_change
This matches other similar hook names.
2020-12-30 15:20:47 +01:00
Andreas Kling 3b445bc66a LibGUI: Add page_step setting to AbstractSlider and use it in Slider
This makes clicking on the track of a GUI::Slider actually move the
knob more than 1 value unit (assuming page_step > 1)
2020-12-30 15:20:47 +01:00
Andreas Kling fa836a4dda LibGUI: Add GUI::AbstractSlider and move generic parts of Slider there
This will allow us to share some code between Slider and ScrollBar.
2020-12-30 15:20:47 +01:00
Linus Groh 761169f5c0 CrashReporter: Show PID from coredump 2020-12-30 15:00:17 +01:00
Linus Groh bde65ba7ca CrashReporter: Read executable path from coredump process info
We no longer have to look at the backtrace and guess the executable,
it's now embedded in the coredump's ProcessInfo notes entry directly.

Fixes #4645.
2020-12-30 15:00:17 +01:00
Linus Groh 6fe6e0a36a Kernel: Embed a ProcessInfo notes entry in coredumps 2020-12-30 15:00:17 +01:00
Linus Groh a28954a882 LibELF+LibCoreDump: Add a ProcessInfo notes entry
This is a new NotesEntry type which contains information related to the
coredump's process:

- PID
- executable path

Having these in the coredump explicitly avoids having to parse them from
the coredump filename and backtrace, respectively.
2020-12-30 15:00:17 +01:00
Andreas Kling 9227e66bb4 LibGUI: Use Window::center_within() in GUI::Dialog 2020-12-30 13:44:58 +01:00
Andreas Kling 2c9147154c Terminal+LibVT: Add settings window to the terminal context menu 2020-12-30 13:42:16 +01:00
Andreas Kling 04e3bcfa75 LibGUI: Add Window::center_within(Window)
This allows you to easily center one window within another window.
2020-12-30 13:41:53 +01:00
AnotherTest 4a2da10e38 ProtocolServer: Stream the downloaded data if possible
This patchset makes ProtocolServer stream the downloads to its client
(LibProtocol), and as such changes the download API; a possible
download lifecycle could be as such:
notation = client->server:'>', server->client:'<', pipe activity:'*'
```
> StartDownload(GET, url, headers, {})
< Response(0, fd 8)
* {data, 1024b}
< HeadersBecameAvailable(0, response_headers, 200)
< DownloadProgress(0, 4K, 1024)
* {data, 1024b}
* {data, 1024b}
< DownloadProgress(0, 4K, 2048)
* {data, 1024b}
< DownloadProgress(0, 4K, 1024)
< DownloadFinished(0, true, 4K)
```

Since managing the received file descriptor is a pain, LibProtocol
implements `Download::stream_into(OutputStream)`, which can be used to
stream the download into any given output stream (be it a file, or
memory, or writing stuff with a delay, etc.).
Also, as some of the users of this API require all the downloaded data
upfront, LibProtocol also implements `set_should_buffer_all_input()`,
which causes the download instance to buffer all the data until the
download is complete, and to call the `on_buffered_download_finish`
hook.
2020-12-30 13:31:55 +01:00
AnotherTest 36d642ee75 pro: Add support for sending POST requests and custom headers 2020-12-30 13:31:55 +01:00
AnotherTest 4e203f7e2d AK: Add {Input,Output}FileStream
Unlike the ones in LibCore, these only wrap an stdio FILE* (or an fd,
which they close when destroyed).
2020-12-30 13:31:55 +01:00
AnotherTest bf7cda414f AK: Add a ByteBuffer::copy(ReadonlyBytes) overload 2020-12-30 13:31:55 +01:00
AnotherTest e7e5a5e677 Base: Add Amazon's intermediate root certificate (Server CA 1B) 2020-12-30 13:31:55 +01:00
Andrew Kaster 7d49ea9836 AK: Replace some SFINAE with requires clauses, clean up existing ones
Add requires clauses to constraints on InputStream and OutputStream
operator<< / operator>>. Make the constraint on String::number a
requires clause instead of SFINAE. Also, fix some unecessary IsSame in
Trie where specialized traits exist for the given use cases.
2020-12-30 13:28:49 +01:00
Tom 49a76164c8 Kernel: Consolidate the various BlockCondition::unblock variants
The unblock_all variant used to ASSERT if a blocker didn't unblock,
but it wasn't clear from the name that it would do that. Because
the BlockCondition already asserts that no blockers are left at
destruction time, it would still catch blockers that haven't been
unblocked for whatever reason.

Fixes #4496
2020-12-30 13:23:17 +01:00
Andreas Kling 94e4aa94b5 Terminal: Tweak height of settings window 2020-12-30 13:15:23 +01:00
Andreas Kling db086ef9cc Terminal: Make the find shortcut Ctrl+Shift+F
Let's leave all the Ctrl+Letter shortcuts for the TTY itself.
2020-12-30 12:53:50 +01:00
Andreas Kling 5e46a911ae Base: Remove some low-quality color themes 2020-12-30 12:53:50 +01:00
AnotherTest 7d30692ac2 Playground: Add autocomplete 2020-12-30 12:53:39 +01:00
AnotherTest 90aeacbb58 LibGUI: Register a whole bunch of properties in various widgets 2020-12-30 12:53:39 +01:00
AnotherTest 20b74e4ede LibGUI+HackStudio: Add an opt-in autocompletion interface to TextEditor
...and use that to implement autocomplete in HackStudio.

Now everyone can have autocomplete :^)
2020-12-30 12:53:39 +01:00
Idan Horowitz 7e457b98c3 Terminal: Remove redundant scroll length settings option
This is no longer needed as a global one is now available
under mouse settings.
2020-12-30 11:58:52 +01:00
Idan Horowitz fd945c8007 Applications: Added a new MouseSettings application
This app allows the user to easily adjust his mouse's acceleration
as well as the scrollwheel's global scroll length.

The mouse acceleration changes would not be noticeable in qemu as
by default serenity uses VMWareBackdoor when available which lets
the host handle mouse movement instead of the guest (Serenity),
so in order to test this on a none-baremetal pc the VMWareBackdoor
has to be disabled.
2020-12-30 11:58:52 +01:00
Idan Horowitz 8159ce384d WindowServer: Added IPC requests for getting and setting mouse settings
These include the mouse acceleration factor and the scroll length
step size.
2020-12-30 11:58:52 +01:00
Idan Horowitz db409db4e9 WindowServer: Added configurable mouse acceleration and scroll length
The settings are also saved to the config file to survive reboots.
2020-12-30 11:58:52 +01:00
Andrew Kaster 0c51778510 AK: Move String::number entirely to header file
Use SFINAE to enforce the fact that it's supposed to only be called for
Arithmetic types, rather than counting on the linker to tell us that an
instantiation of String::number(my_arg) was not found. This also adds
String::number for floating point types as a side-effect.
2020-12-30 11:32:20 +01:00
Andrew Kaster b4eb734204 AK: Add tests for type traits and IndexSequence
Use TypeLists to add test for IsIntegral, IsFloatingPoint, IsVoid,
IsNullPointer, IsArithmetic, IsFundamental, and AddConst type traits.

More can "easily" be added once the TypeList and macro magic is squinted
at for long enough :).
2020-12-30 11:32:20 +01:00
Andrew Kaster 3bf77f01a7 AK: Add a TypeList class for expanded compile-time tools
Also add IndexSequence and associated helpers. The TypeList class can be
queried for what type is at a certain index, and there are two helper
functions: for_each_type, and for_each_type_zipped.

for_each_type will invoke a lambda with a TypeWrapper object for
each type in the type list. The original type can be obtained by
extracting the ::Type from the type of your generic lambda's one
argument.

for_each_type_zipped will walk two TypeLists in lockstep and pass a
TypeWrapper object for the current index in each list to a generic
lambda. The original type from the TypeList can again be extracted via
the ::Type of the generic lambda's two parameters.
2020-12-30 11:32:20 +01:00
Andrew Kaster fe4b44b489 AK: Add IsArithmetic and IsFundamental type traits
Also, make sure to using AK::IsNullPointer
2020-12-30 11:32:20 +01:00
Andrew Kaster 874df07ffd AK: Correct name in TestMain for TestTrie
Copy paste error :)
2020-12-30 11:32:20 +01:00
Andrew Kaster 06b6f838d6 AK: Use MacOS pthread_get_stacksize_np to get stack size for StackInfo
Seems Rust and OpenJDK both had issues with getting accurate stack size
for the main thread with MacOS Maverick and above. Apply a variant of
their workarounds. We could probably assume 8MB in all cases just to
be safe, as the only user of AK::StackInfo right now is lib JS's heap
for determining possible pointer candidates. But, this approach should
work if userspace apps start trying to add custom guard pages, as well.
2020-12-30 11:28:50 +01:00
Andreas Kling bc0658ce27 FileManager: Use GUI::SeparatorWidget in the properties dialog
This looks a lot better than putting a GUI::Frame in there.
2020-12-30 03:53:37 +01:00
Andreas Kling 5b1a6d7c66 LibGUI: Move GUI::SeparatorWidget from ToolBar.cpp to its own file
This makes this nice line separator widget usable outside toolbars.
Also support both horizontal and vertical orientation. :^)
2020-12-30 03:52:27 +01:00