Commit Graph

27022 Commits

Author SHA1 Message Date
Nico Weber
a8d96df8e0 Kernel: Build MiniStdLib.cpp in aarch64 builds 2021-09-07 20:15:15 +01:00
Nico Weber
208aa05cf3 Kernel: Build UBSanitizer.cpp in aarch64 builds
All these symbols will be needed once we build MiniStdLib.cpp.
2021-09-07 20:15:15 +01:00
Nico Weber
d0b0c45690 Kernel: Remove two unused includes from Prekernel/UBSanitizer.cpp 2021-09-07 20:15:15 +01:00
Ali Mohammad Pur
7fefb8148b LibRegex: Use the correct capture group index in ERE bytecode generation
Otherwise the left and right capture instructions wouldn't point to the
same capture group if there was another nested group there.
2021-09-07 20:01:58 +02:00
Luke Wilde
44b8afdbc4 LibWeb: Don't trim whitespace when checking for "module" type on scripts
No major engine allows whitespace in the type when checking for
"module".

This was also reflected in the relevant web platform test, but not in
the spec.

The spec has been changed to match this behaviour: 23c723e3e9
2021-09-07 17:22:24 +02:00
Mustafa Quraish
405b282bc3 PixelPaint: Show mouse position in statusbar without active tool
Showing the position only with an active tool seems a bit confusing,
if you've opened up an image just to find out the coordinates of
a pixel for instance, there shouldn't be a need to have to select
a tool first.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
736ab4f83a PixelPaint: Add Menu action/shortcut to close current image tab
Ctrl+W now closes the current Image tab.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
255f729c1f PixelPaint: Register RectangleTool thickness slider as primary
... So we can use `[` and `]` shortcuts to change the size.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
d6348e1b32 PixelPaint: Use correct thickness in RectangleTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
603d3a5dc6 PixelPaint: Use correct thickness in LineTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
0a9c64a4f5 PixelPaint: Use correct thickness in EllipseTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Andreas Kling
9669bf29f6 Kernel: Make Device request creation return KResultOr
This allows us to propagate errors in a bunch of new places.
2021-09-07 16:42:03 +02:00
Andreas Kling
a01b19c878 Kernel: Remove KBuffer::try_copy() in favor of try_create_with_bytes()
These were already equivalent, so let's only have one of them.
2021-09-07 16:22:29 +02:00
Andreas Kling
8ded4ad88c Kernel: Simplify KBuffer by removing KBufferImpl
This patch moves everything from KBufferImpl into KBuffer instead.
One layer of indirection is removed, and the whole thing is massively
simplified. :^)
2021-09-07 16:20:47 +02:00
Andreas Kling
60b892772f Kernel: Remove more unused KBuffer API 2021-09-07 16:11:31 +02:00
Andreas Kling
881923dd47 Kernel: Remove KBuffer::is_null() and bogus call sites :^) 2021-09-07 16:00:39 +02:00
Andreas Kling
1a04dc9cba Kernel: Enforce the fact that KBuffer always has internal storage
There are no remaining code paths where KBuffer can end up with a null
internal storage pointer, so let's make it a NonnullRefPtr.
2021-09-07 15:59:34 +02:00
Andreas Kling
16cd86b845 Kernel: Remove some unused KBuffer functions 2021-09-07 15:58:18 +02:00
Andreas Kling
300402cc14 Kernel: Make it possible for KBufferBuilder creation to fail
This patch adds KBufferBuilder::try_create() and treats it like anything
else that can fail. And so, failure to allocate the initial internal
buffer of the builder will now propagate an ENOMEM to the caller. :^)
2021-09-07 15:54:23 +02:00
Andreas Kling
be613b9ef6 Kernel: Remove unused KBufferImpl::expand() 2021-09-07 15:45:36 +02:00
Andreas Kling
2c262ddf0f Kernel: Make KBufferBuilder use KBuffer instead of KBufferImpl
This was the last remaining direct client of the KBufferImpl class
outside of KBuffer.
2021-09-07 15:44:45 +02:00
Andreas Kling
b300f9aa2f Kernel: Convert KBuffer::copy() => KBuffer::try_copy()
This was a weird KBuffer API that assumed failure was impossible.
This patch converts it to a modern KResultOr<NonnullOwnPtr<KBuffer>> API
and updates the two clients to the new style.
2021-09-07 15:36:39 +02:00
Andreas Kling
250b52d6e5 Kernel: Make KBuffer::try_create_with_bytes() return KResultOr 2021-09-07 15:22:24 +02:00
Andreas Kling
899cee8185 Kernel: Make KBuffer::try_create_with_size() return KResultOr
This allows us to use TRY() in a lot of new places.
2021-09-07 15:15:08 +02:00
Andreas Kling
c69035c630 Kernel: TCPSocket always has a scratch buffer
Let's encode this in the constructor signature.
2021-09-07 15:11:49 +02:00
Andreas Kling
308773ffda Kernel/Net: Add a special SOCKET_TRY() and use it in socket code
Sockets remember their last error code in the SO_ERROR field, so we need
to take special care to remember this when returning an error.

This patch adds a SOCKET_TRY() that works like TRY() but also calls
set_so_error() on the failure path.

There's probably a lot more code that should be using this, but that's
outside the scope of this patch.
2021-09-07 15:05:51 +02:00
Andreas Kling
3c44e381d4 Kernel: Use TRY() some more in Socket 2021-09-07 14:55:44 +02:00
Andreas Kling
cd5d483bbd Kernel: Use KResultOr and TRY() for ThreadTracer
Also make the constructor private, since it's only called by the static
factory function.
2021-09-07 14:48:13 +02:00
Andreas Kling
ededd6aac6 Kernel: Make TCPSocket client construction use KResultOr and TRY()
We don't really have anywhere to propagate the error in NetworkTask at
the moment, since it runs in its own kernel thread and has no direct
userspace caller.
2021-09-07 14:44:29 +02:00
Andreas Kling
ed5d04b0ea Kernel: Use KResultOr and TRY() for FIFO 2021-09-07 13:58:16 +02:00
Andreas Kling
631b8e90cd Kernel: Use KResultOr and TRY() for MasterPTY 2021-09-07 13:58:16 +02:00
Andreas Kling
01993d0af3 Kernel: Make DoubleBuffer::try() return KResultOr
This tidies up error propagation in a number of places.
2021-09-07 13:53:14 +02:00
Andreas Kling
213b8868af Kernel: Rename file_description(fd) => open_file_description(fd)
To go with the class rename.
2021-09-07 13:53:14 +02:00
Andreas Kling
4a9c18afb9 Kernel: Rename FileDescription => OpenFileDescription
Dr. POSIX really calls these "open file description", not just
"file description", so let's call them exactly that. :^)
2021-09-07 13:53:14 +02:00
Andreas Kling
dbd639a2d8 Kernel: Convert much of sys$execve() to using KString
Make use of the new FileDescription::try_serialize_absolute_path() to
avoid String in favor of KString throughout much of sys$execve() and
its helpers.
2021-09-07 13:53:14 +02:00
Andreas Kling
226383f45b LibELF: Use StringView to carry temporary strings in auxiliary vector
Let's not force clients to provide a String.
2021-09-07 13:53:14 +02:00
Andreas Kling
cae20d2aa9 Kernel: Add FileDescription::try_serialize_absolute_path()
Unlike FileDescription::absolute_path(), this knows that failures can
happen and will propagate them to the caller.
2021-09-07 13:53:14 +02:00
Andreas Kling
a27c6f5226 Kernel: Avoid unnecessary String allocation in sys$statvfs() 2021-09-07 13:53:14 +02:00
Andreas Kling
6ad427993a Everywhere: Behaviour => Behavior 2021-09-07 13:53:14 +02:00
Andreas Kling
55b0b06897 Kernel: Store process names as KString 2021-09-07 13:53:14 +02:00
Andreas Kling
db2e67fd53 Kernel: Tidy up ProcessProcFSTraits construction a bit more
Let the constructor take a Process& instead of a WeakPtr<Process> and
avoid a bunch of WeakPtr copying.
2021-09-07 13:53:14 +02:00
Andreas Kling
b481132418 Kernel: Make UserOrKernelBuffer return KResult from read/write/memset
This allows us to simplify a whole bunch of call sites with TRY(). :^)
2021-09-07 13:53:14 +02:00
Liav A
7bf8844499 Kernel/PCI: Turn on memory access by default
This will allow the Kernel to utilize memory access to the PCI
configuration space if such method is available.
2021-09-07 13:47:37 +02:00
Liav A
25ea7461a0 Kernel/PCI: Simplify the entire subsystem
A couple of things were changed:
1. Semantic changes - PCI segments are now called PCI domains, to better
match what they are really. It's also the name that Linux gave, and it
seems that Wikipedia also uses this name.
We also remove PCI::ChangeableAddress, because it was used in the past
but now it's no longer being used.
2. There are no WindowedMMIOAccess or MMIOAccess classes anymore, as
they made a bunch of unnecessary complexity. Instead, Windowed access is
removed entirely (this was tested, but never was benchmarked), so we are
left with IO access and memory access options. The memory access option
is essentially mapping the PCI bus (from the chosen PCI domain), to
virtual memory as-is. This means that unless needed, at any time, there
is only one PCI bus being mapped, and this is changed if access to
another PCI bus in the same PCI domain is needed. For now, we don't
support mapping of different PCI buses from different PCI domains at the
same time, because basically it's still a non-issue for most machines
out there.
2. OOM-safety is increased, especially when constructing the Access
object. It means that we pre-allocating any needed resources, and we try
to find PCI domains (if requested to initialize memory access) after we
attempt to construct the Access object, so it's possible to fail at this
point "gracefully".
3. All PCI API functions are now separated into a different header file,
which means only "clients" of the PCI subsystem API will need to include
that header file.
4. Functional changes - we only allow now to enumerate the bus after
a hardware scan. This means that the old method "enumerate_hardware"
is removed, so, when initializing an Access object, the initializing
function must call rescan on it to force it to find devices. This makes
it possible to fail rescan, and also to defer it after construction from
both OOM-safety terms and hotplug capabilities.
2021-09-07 13:47:37 +02:00
Brian Gianforcaro
d1378339f6 Kernel: Avoid string creation for simple string comparison 2021-09-07 13:16:01 +02:00
Brian Gianforcaro
abc523a5ab Kernel: Specify a lock rank for s_mm_lock 2021-09-07 13:16:01 +02:00
Brian Gianforcaro
88c27fc38e Kernel: Specify a lock rank for Thread::m_lock 2021-09-07 13:16:01 +02:00
Brian Gianforcaro
f6b1517426 Kernel/Locking: Add lock rank tracking to Spinlock/RecursiveSpinlock 2021-09-07 13:16:01 +02:00
Brian Gianforcaro
066b0590ec Kernel/Locking: Add lock rank tracking per thread to find deadlocks
This change adds a static lock hierarchy / ranking to the Kernel with
the goal of reducing / finding deadlocks when running with SMP enabled.

We have seen quite a few lock ordering deadlocks (locks taken in a
different order, on two different code paths). As we properly annotate
locks in the system, then these facilities will find these locking
protocol violations automatically

The `LockRank` enum documents the various locks in the system and their
rank. The implementation guarantees that a thread holding one or more
locks of a lower rank cannot acquire an additional lock with rank that
is greater or equal to any of the currently held locks.
2021-09-07 13:16:01 +02:00
Brian Gianforcaro
0718afa773 Kernel: Track when a thread is in the middle of crashing
There are certain checks that we should skip if the system is crashing.
The system can avoid stack overflow during crash, or even triple
faulting while while handling issues that can causes recursive panics
or aborts.
2021-09-07 13:16:01 +02:00