Commit graph

14302 commits

Author SHA1 Message Date
Andreas Kling
df3a70eac2 UserspaceEmulator: Support FCMOVBE and FCMOVNBE 2020-11-13 11:05:46 +01:00
Andreas Kling
ae81ced21c UserspaceEmulator: Emulate the sys$get_stack_bounds() syscall 2020-11-13 11:05:46 +01:00
Andreas Kling
04d9af79ac UserspaceEmulator: Initial FPU support (by @nico)
Start fleshing out basic support for floating-point instructions in the
UserspaceEmulator CPU.

This is all work done by @nico for #3576. I'm just merging it all in
this patch since it's a decent foundation to continue working on. :^)
2020-11-13 11:05:46 +01:00
Andreas Kling
cfc5d146d3 AK: Fix inverted condition in unsigned LEB128 decode 2020-11-13 11:05:46 +01:00
Luke
1993ccb456 LibWeb: Add default values of URL and content type in document
As per this line in the specification:
Unless stated otherwise, a document’s encoding is the utf-8 encoding,
content type is "application/xml", URL is "about:blank", origin is an
opaque origin, type is "xml", and its mode is "no-quirks".

https://dom.spec.whatwg.org/#document
2020-11-13 09:51:07 +01:00
Luke
dcb21b0c3a LibWeb: Add initial implementation of document.implementation 2020-11-13 09:51:07 +01:00
Luke
3ec54448f5 LibWeb: Add contentType attribute to Document 2020-11-13 09:51:07 +01:00
Ben Wiederhake
cf9419fc4f Meta: Nicer IRC notifications 2020-11-13 08:56:56 +01:00
Ben Wiederhake
90f55e607d Meta: Ensure availability of python 2020-11-13 08:56:56 +01:00
Nico Weber
5c2e8b6189 Lagom: Add ntpquery to lagom build 2020-11-12 21:21:33 +01:00
Andreas Kling
81add73955 LibWeb: Make Frame point weakly to Page
This patch makes Page weakable and allows page-less frames to exist.

Page is single-owner, and Frame is multiple-owner, so it's not sound
for Frame to assume its containing Page will stick around for its own
entire lifetime.

Fixes #3976.
2020-11-12 18:29:55 +01:00
Tom
e445ff670d Kernel: Implement an asynchronous device request stack
This allows issuing asynchronous requests for devices and waiting
on the completion of the request. The requests can cascade into
multiple sub-requests.

Since IRQs may complete at any time, if the current process is no
longer the same that started the process, we need to swich the
paging context before accessing user buffers.

Change the PATA driver to use this model.
2020-11-12 18:04:30 +01:00
Tom
91db31880f Kernel: Add I8042Controller to detect and manage PS/2 devices
Rework the PS/2 keyboard and mouse drivers to use a common 8042
controller driver. Also, reset and reconfigure the 8042 controller
as they are not guaranteed to be in the state that we expect.
2020-11-12 18:04:16 +01:00
Tom
e1c27c16d8 Kernel: Assume 8042 controller is present if ACPI FADT revision <= 1
This field wasn't specified until revision 2 and should be assumed to
be set on older versions.
2020-11-12 18:04:16 +01:00
Brendan Coles
7a512c4cc4 Userland: env: Add -i / --ignore-environment arg to clear env 2020-11-12 18:01:45 +01:00
Linus Groh
5a307836c1 LibJS: Handle symbol PropertyName in primitive assignment error
We can't just to_string() the PropertyName, it might be a symbol.
Instead to_value() it and then use to_string_without_side_effects() as
usual.

Fixes #4062.
2020-11-12 11:40:29 +01:00
Luke
3f73b0f896 LibWeb: Add almost all obsolete but required IDL attributes
As according to https://html.spec.whatwg.org/multipage/obsolete.html
Section 16.3 "Requirements for implementations"

Not all of these attributes are included due to requiring a bit more
functionality.
2020-11-12 10:38:26 +01:00
Lenny Maiorani
1643fa2223 InputFileStream: Incorrectly defaulted constructor
Problem:
- The default constructor is is deleted because NonnullRefPtr has no
  default constructor and there is a member variable of that type, but
  the function is set as `= default`.

Solution:
- Remove the code because the function is actually deleted implicitly.
2020-11-12 10:19:52 +01:00
Lenny Maiorani
ad72158ee0 CMake: compile_commands.json output
Problem:
- CMake is not outputting `compile_commands.json`.
- `compile_commands.json` is used by build integration tooling such as
  `clang-tidy`.

Solution:
- Enable `CMAKE_EXPORT_COMPILE_COMMANDS` option so that the file is
  output.
2020-11-12 10:19:43 +01:00
Lenny Maiorani
f5ced347e6 AK: Prefer using instead of typedef
Problem:
- `typedef` is a keyword which comes from C and carries with it old
  syntax that is hard to read.
- Creating type aliases with the `using` keyword allows for easier
  future maintenance because it supports template syntax.
- There is inconsistent use of `typedef` vs `using`.

Solution:
- Use `clang-tidy`'s checker called `modernize-use-using` to update
  the syntax to use the newer syntax.
- Remove unused functions to make `clang-tidy` happy.
- This results in consistency within the codebase.
2020-11-12 10:19:04 +01:00
Tom
6b97118e89 Kernel: Fix race during thread destruction if it is preempted
This fixes a lot of crashes in Bochs, which is more likely to
preempt thread destruction.
2020-11-12 10:18:16 +01:00
Linus Groh
352e0196e1 Meta: s/Travis/GitHub Actions/ in CONTRIBUTING.md 2020-11-12 10:16:45 +01:00
Linus Groh
b443475792 Meta: Add .cache to .gitignore
The current version of clangd on my machine uses .cache/clangd and not
.clangd anymore so let's add that to .gitignore as well.
2020-11-12 10:15:07 +01:00
Linus Groh
e77202fe0f LibJS/Tests: Use canParseSource() for toEval()
We can now enable the "new.target is syntax error outside of function"
test :^)
2020-11-12 10:14:57 +01:00
Linus Groh
7fc98a96a9 test-js: Add canParseSource() native function
This allows us to check code for syntax errors without relying on
Function(), which can lead to false negatives as certain things are
valid in a function context, but not outside one.
2020-11-12 10:14:57 +01:00
Linus Groh
8694d804c7 LibJS: Run prettier on test-common.js 2020-11-12 10:14:57 +01:00
Linus Groh
1b0c862f3a LibJS: Throw TypeError when calling class constructor without 'new' 2020-11-12 10:14:00 +01:00
Linus Groh
b07c7f589f LibJS: Refactor ScriptFunction::call() a bit
- Get VM reference once
- Less nesting
- Better variable names
2020-11-12 10:14:00 +01:00
Brendan Coles
549786e89a Userland: Add test for file SUID+SGID bits stripped when modified 2020-11-11 21:27:29 +01:00
Andreas Kling
b413c7ae6a ls: Only append file type indicators when -F or --classify is specified 2020-11-11 20:46:06 +01:00
Andreas Kling
5aafbdc4e8 ls: Add newline after "ls -d" output
Fixes #4030.
2020-11-11 20:36:16 +01:00
Andreas Kling
23a5a484d5 ClipboardHistory: Bring window to front when applet is clicked
Fixes #4031.
2020-11-11 20:31:35 +01:00
Lenny Maiorani
5570b16f6f RefPtrTraits: struct/class mismatch in forward declaration
Problem:
- Building with clang is broken because of the `struct` vs `class`
  mismatch between the definition and declaration.

Solution:
- Change `class` to `struct` in the forward declaration.
2020-11-11 20:25:29 +01:00
AmusedNetwork
de6483bcdb LibGUI: Set vertical distance between icons relative to scroll value
When calculating the vertical distance between icons, we should take
into account the value of the vertical scrollbar.

Fixes #4040
2020-11-11 15:14:09 +01:00
Tom
dc9ddf8104 Kernel: Fix deadlock when unicasting/broadcasting SMP message
When two processors send each others a SMP message at the same time
they need to process messages while waiting for delivery of the
message they just sent, or they will deadlock.
2020-11-11 12:27:25 +01:00
Tom
3ee7c21fae Kernel: Implement capturing stack trace on a different CPU
When trying to get a stack trace of a thread on another CPU we send
a SMP message to that processor to capture the stack trace for us.
2020-11-11 12:27:25 +01:00
Tom
5b38132e3c Kernel: Protect the PageDirectory from concurrent access 2020-11-11 12:27:25 +01:00
Tom
2b25a89ab5 Kernel: Add locks around RangeAllocator
We need to keep multiple processors from changing it at the same time.
2020-11-11 12:27:25 +01:00
Tom
66f46d03e4 Kernel: Minor Lock optimization 2020-11-11 12:27:25 +01:00
Tom
b4c9e85056 Kernel: Minor SpinLock improvements 2020-11-11 12:27:25 +01:00
Tom
e26e0445b5 Kernel: Make m_halt_requested an atomic variable
We need to make sure the change to this variable is visible to all
processors instantly.
2020-11-11 12:27:25 +01:00
Tom
a14884dd33 Kernel: Lock needs to call Processor::wait_check while looping
We need to process SMP messages while looping.
2020-11-11 12:27:25 +01:00
Lenny Maiorani
72d019f4a4 IPv4Address: constexpr support
Problem:
- IPv4Address class cannot be used in a compile-time context.
- A union is used by initializing one of the members and reading the
  non-active member. This is undefined behavior and not permitted in a
  `constexpr` context.

Solution:
- Eliminate undefined behavior by changing to a simple `u32` for
  storage instead of the union and performing mask/shift calculations
  for obtaining the individual octets.
- Decorate functions with `constexpr` where possible. Currently string
  formatting and optionals are not `constexpr`-capable so functions
  using those are left out.
- Modify tests to validate functionality in a `constexpr` context in
  addition to the run-time tests already being run. This ensures that
  functionality is the same in both contexts.
2020-11-11 12:18:25 +01:00
Luke
62a74bf282 LibWeb: Advertise to servers that we support gzip encoding
We've had gzip support for a while now, but it never really got
used because we never advertised it.
2020-11-11 12:15:18 +01:00
Luke
397049aae8 LibWeb: Move innerText from DOM::Element to HTML::HTMLElement 2020-11-11 12:15:05 +01:00
Luke
bb22b04d44 LibWeb+LibJS: Add [LegacyNullToEmptyString] attribute
If specified, to_string() returns an empty string instead of "null" for
null values.
2020-11-11 12:15:05 +01:00
Andreas Kling
1745e503aa LibJS: Use a HashTable to identify potential cell pointers in GC scan
Previously we would iterate over all the live HeapBlocks in order to
learn if an arbitrary pointer-sized value was a pointer into a live
HeapBlock. This was quite time-consuming.

Instead of that, just put all the live HeapBlock*'s in a HashTable
and identify pointers by doing a bit-masked lookup into the table.
2020-11-10 20:28:53 +01:00
Andreas Kling
50aa726db7 LibGUI: Ignore application-global shortcuts in modal windows
This is making me question the usefulness of application-global
shortcuts, but for now let's just prevent them from triggering while
you're looking at a modal message box..
2020-11-10 19:41:03 +01:00
Andreas Kling
ebaf20547c WindowServer: Show modal window's cursor over blocked windows
When a window is blocked by a modal window from the same application,
we now prefer the modal window's cursor instead of the hovered window.
2020-11-10 19:30:22 +01:00
Tom
75f61fe3d9 AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe
This makes most operations thread safe, especially so that they
can safely be used in the Kernel. This includes obtaining a strong
reference from a weak reference, which now requires an explicit
call to WeakPtr::strong_ref(). Another major change is that
Weakable::make_weak_ref() may require the explicit target type.
Previously we used reinterpret_cast in WeakPtr, assuming that it
can be properly converted. But WeakPtr does not necessarily have
the knowledge to be able to do this. Instead, we now ask the class
itself to deliver a WeakPtr to the type that we want.

Also, WeakLink is no longer specific to a target type. The reason
for this is that we want to be able to safely convert e.g. WeakPtr<T>
to WeakPtr<U>, and before this we just reinterpret_cast the internal
WeakLink<T> to WeakLink<U>, which is a bold assumption that it would
actually produce the correct code. Instead, WeakLink now operates
on just a raw pointer and we only make those constructors/operators
available if we can verify that it can be safely cast.

In order to guarantee thread safety, we now use the least significant
bit in the pointer for locking purposes. This also means that only
properly aligned pointers can be used.
2020-11-10 19:11:52 +01:00