Commit graph

26103 commits

Author SHA1 Message Date
Liav A
7b9c3439ec Kernel/PCI: Delete PCI::Device in its current form
I created this class a long time ago just to be able to quickly make a
PCI device to also represent an interrupt handler (because PCI devices
have this capability for most devices).
Then after a while I introduced the PCI::DeviceController, which is
really almost the same thing (a PCI device class that has Address member
in it), but is not tied to interrupts so it can have no interrupts, or
spawn interrupt handlers however it wants to seems fit.

However I decided it's time to say goodbye for this class for
a couple of reasons:
1. It made a whole bunch of weird patterns where you had a PCI::Device
and a PCI::DeviceController being used in the topic of implementation,
where originally, they meant to be used mutually exclusively (you
can't and really don't want to use both).
2. We can really make all the classes that inherit from PCI::Device
to inherit from IRQHandler at this point. Later on, when we have MSI
interrupts support, we can go further and untie things even more.
3. It makes it possible to simplify the VirtIO implementation to a great
extent. While this commit almost doesn't change it, future changes
can untangle some complexity in the VirtIO code.

For UHCIController, E1000NetworkAdapter, NE2000NetworkAdapter,
RTL8139NetworkAdapter, RTL8168NetworkAdapter, E1000ENetworkAdapter we
are simply making them to inherit the IRQHandler. This makes some sense,
because the first 3 devices will never support anything besides IRQs.
For the last 2, they might have MSI support, so when we start to utilize
those, we might need to untie these classes from IRQHandler and spawn
IRQHandler(s) or MSIHandler(s) as needed.

The VirtIODevice class is also a case where we currently need to use
both PCI::DeviceController and IRQHandler classes as parents, but it
could also be untied from the latter.
2021-08-23 01:07:45 +02:00
Liav A
d071ce352c Kernel/VirtIO: Make VirtIODevice constructor protected
This should be accessible only by derived classes.
2021-08-23 01:07:45 +02:00
Timothy Flynn
4f186a9a1f LibJS: Implement Promise.race on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
949f294444 LibJS: Implement Promise.allSettled on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
4dffa40a8d LibJS: Implement Promise.any on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
98d8a858cd LibJS: Set the function names for the resolve, reject, and executor
These should all have a name with an empty string. Not only does test262
verify this, but it also verifies that (for the executor) the name
property is defined after the length property.
2021-08-23 00:01:46 +01:00
Timothy Flynn
5b303721e0 LibJS: Generalize PerformPromiseAll common functionality
PerformPromiseAll, PerformPromiseAny, PerformPromiseAllSettled, etc, all
have very similar iteration loops. To avoid duplicating this rather
large block of code, extract the common functionality into a separate
method.
2021-08-23 00:01:46 +01:00
Timothy Flynn
417523507e LibJS: Generalize PromiseAllResolveElementFunction common functionality
The element-resolving functions on the Promise constructor are all very
similar. To prepare for more of these functions to be implemented, break
out common parts into a base class.
2021-08-23 00:01:46 +01:00
Andreas Kling
40bc378d81 Kernel: Rename QueueBlocker => WaitQueueBlocker
This is a Thread::Blocker that blocks on a WaitQueue, so let's call it
a WaitQueueBlocker to improve clarity. :^)
2021-08-23 00:10:33 +02:00
Andreas Kling
b30081b49a Kernel: Rename BlockerSet::unblock() to something more accurate
Namely, unblock_all_blockers_whose_conditions_are_met().

The old name made it sound like things were getting unblocked no matter
what, but that's not actually the case.

What this actually does is iterate through the set of blockers,
unblocking those whose conditions are met. So give it a (very) verbose
name that errs on the side of descriptiveness.
2021-08-23 00:02:09 +02:00
Andreas Kling
6c16bedd69 Kernel: Remove unnecessary FutexQueue::did_remove()
This was only ever called immediately after FutexQueue::try_remove()
to VERIFY() that the state looks exactly like it should after returning
from try_remove().
2021-08-23 00:02:09 +02:00
Andreas Kling
928929bbe1 Kernel: VERIFY that nobody is holding lock in ~BlockerSet()
By the time we end up destroying a BlockerSet, we don't need to take
the internal spinlock. And nobody else should be holding it either.
So replace the SpinlockLocker with a VERIFY().
2021-08-23 00:02:09 +02:00
Andreas Kling
85546af417 Kernel: Rename Thread::BlockCondition to BlockerSet
This class represents a set of Thread::Blocker objects attached to
something that those blockers are waiting on.
2021-08-23 00:02:09 +02:00
Andreas Kling
05e1b196e9 Kernel: Make Processor::clean_fpu_state() static
This function returns the same identical FPU state for all CPU's, so
there's no point requiring a Processor instance.
2021-08-23 00:02:09 +02:00
Andreas Kling
8000e8a080 Kernel: Mark Thread::Blocker leaf subclasses final 2021-08-23 00:02:09 +02:00
Andreas Kling
53019f413c Kernel: Mark BlockCondition subclasses as final 2021-08-23 00:02:09 +02:00
Andreas Kling
bcd2025311 Everywhere: Core dump => Coredump
We all know what a coredump is, and it feels more natural to refer to
it as a coredump (most code already does), so let's be consistent.
2021-08-23 00:02:09 +02:00
Andreas Kling
a930877f31 Kernel: Mape quickmap functions VERIFY that MM lock is held
The quickmap_page() and unquickmap_page() functions are used to map a
single physical page at a kernel virtual address for temporary access.

These use the per-CPU quickmap buffer in the page tables, and access to
this is guarded by the MM lock. To prevent bugs, quickmap_page() should
not *take* the MM lock, but rather verify that it is already held!

This exposed two situations where we were using quickmap without holding
the MM lock during page fault handling. This patch is forced to fix
these issues (which is great!) :^)
2021-08-23 00:02:09 +02:00
Andreas Kling
1b9916439f Kernel: Make Processor::platform_string() return StringView 2021-08-23 00:02:09 +02:00
Andreas Kling
492b7152d9 Kernel: Consolidate I386/X86_64 implementations of do_init_context()
We can use ThreadRegisters::set_flags() to avoid the #ifdef's here.
2021-08-23 00:02:09 +02:00
Andreas Kling
7a4f6da61b Kernel: Fix some trivial clang-tidy warnings in x86/common/Processor.cpp 2021-08-23 00:02:09 +02:00
Andreas Kling
dea93a8bb9 Kernel: Rename Processor::id() => current_id()
And let id() be the non-static version that gives you the ID of a
Processor object.
2021-08-23 00:02:09 +02:00
Andreas Kling
0f03a8aece Kernel: Add VERIFY(!m_in_block) when entering Thread::block() 2021-08-23 00:02:09 +02:00
Andreas Kling
d60635cb9d Kernel: Convert Processor::in_irq() to static current_in_irq()
This closes the race window between Processor::current() and a context
switch happening before in_irq().
2021-08-23 00:02:09 +02:00
Andreas Kling
3e3f760808 Kernel: Fix some trivial clang-tidy warnings in Thread.{cpp,h} 2021-08-23 00:02:09 +02:00
Liav A
cd52eb3103 Kernel/SysFS: Don't expose SMBIOS blobs if can't find SMBIOS tables
Don't assume that a platform machine will provide at least the 32 bit
version of SMBIOS tables. If there's no SMBIOS tables, don't expose
directory entries in the /sys/bios/ directory.
2021-08-22 23:42:20 +02:00
Karol Kosek
8d3304f853 HackStudio: Update every editor with matching filename on 'Save as...'
Prior this change, if user had more than two copies of one file opened
in a split view, then only the active editor was renamed,
when the others had the same file contents changed.

This change will set a new file name for every file.

The is_null() check is for uncreated files, as they shouldn't be
treated as the same single file.
2021-08-22 23:41:53 +02:00
Karol Kosek
90396f5b08 HackStudio: Convert selected path to a relative path on 'Save as...'
This makes the editor title a bit more consistent with the other files
and removes duplicating the file name in the file history
when reopening that file.
2021-08-22 23:41:53 +02:00
Ralf Donau
9bef96748d Games: Make cpath appear once in the pledge promises 2021-08-22 23:39:41 +02:00
Linus Groh
969aee2022 LibJS: Add missing builtin calendar check to ParseTemporalCalendarString
See: https://github.com/tc39/proposal-temporal/commit/48b11d6
2021-08-22 21:20:00 +01:00
Richard Wurth
4b2953125b AK: Use POSIX specified types for Time::to_timespec and to_timeval
The previous implementation assumed 64-bit time_t and 32-bit long,
which is not true on some 32-bit systems
2021-08-22 17:07:11 +02:00
Itamar
f5b69dce0b Utilities: Add -d option to gzip
This option specifies that we should perform decompression instead of
compression.
2021-08-22 16:51:18 +02:00
Robert Stefanic
e4f040147f SQLServer: Use m_client_id instead of client_id in callback
In the DatabaseConnection constructor, there's a deferred_invoke
callback that references the client_id. But depending on when the
callback occurs, the reference of the client_id can change. This created
a problem when connecting to SQLServer using the SQL utility because
depending on when the callback was invoked, the client_id could change.

m_client_id is set in the constructor and that reference will not change
depending on when the callback is invoked.
2021-08-22 15:32:09 +02:00
Andrew January
9a4c1c019a LibGUI: Make Ctrl+Shift+Right select text
Ctrl+Shift+Left would add the word before the cursor to the selection,
but for some reason Ctrl+Shift+Right didn't add the word after the
cursor to the selection.
2021-08-22 15:31:27 +02:00
Maciej Zygmanowski
7237972022 LibC: Support getsignalbyname() with full signal name
This allows e.g. to use `kill` with names like -SIGKILL, not only -KILL.
2021-08-22 15:23:25 +02:00
Lennon Donaghy
283d8d3928 HackStudio: Warn about unsaved changes on opening different project 2021-08-22 10:30:06 +02:00
Lennon Donaghy
82b88c6e16 HackStudio: Fix editor not marking file with unsaved changes as dirty
The editor's on_change callback was being overwritten in
HackStudioWidget.cpp in order to call update_gml_preview on every
change. This stopped the original callback from being called and marking
files as dirty when changed.

Now we call update_gml_preview in a new callback within the editor
wrapper, which is then called within the original on_change callback
in the editor.
2021-08-22 10:30:06 +02:00
Lennon Donaghy
d454c63bde HackStudio: Fix GitWidget issues with switching between projects
GitWidget no longer crashes upon trying to create a repository for a new
project, and it correctly updates after opening a different project. A
new method, change_repo, has been added to make this work, which changes
m_repo_root and resets most of the widget's state in order to make this
work.
2021-08-22 10:30:06 +02:00
Lennon Donaghy
d9c295de46 HackStudio: Moved code closing project from open_project to own method
Take the code which closes the current project out of open_project
method and move it into its own method.
2021-08-22 10:30:06 +02:00
Lennon Donaghy
3ce96134b5 HackStudio: Call update_gml_preview() to reset when opening new project 2021-08-22 10:30:06 +02:00
Lennon Donaghy
5ca888132d HackStudio: Make FindInFilesWidget reset when opening new project
Add method to FindInFilesWidget which resets the model in order to
clear the output when needed, and use this when a new project is opened.
2021-08-22 10:30:06 +02:00
Lennon Donaghy
ff2a1ee8b0 HackStudio: Stop debugger when opening new project
Moved code to stop the debugger in the HackStudioWidget destructor to
a new method so that this can be called in both the destructor and when
opening a new project.
2021-08-22 10:30:06 +02:00
Lennon Donaghy
971a5a70d1 HackStudio: Clear embedded terminal upon opening a different project 2021-08-22 10:30:06 +02:00
Lennon Donaghy
6076deae1d HackStudio: Clear ToDo entries upon opening new project
The ToDoEntries and ToDoEntriesWidget classes now have methods for
clearing the entries, before entries would stay permanently, even after
switching to a new project.
2021-08-22 10:30:06 +02:00
Lennon Donaghy
d48bd49002 HackStudio: Move handle_external_file_deletion logic into own method
Added a close_file_in_all_editors method to HackStudioWidget and moved
the code from handle_external_file_deletion into it so that it can be
reused elsewhere to close files.
2021-08-22 10:30:06 +02:00
Karol Kosek
219206725b LibGUI: Always resize the mapping rows when sorting
Prior this change, creating a file or directory
on Desktop crashed the desktop instance of FileManager.

Closes: #9560
2021-08-22 10:29:17 +02:00
Peter Elliott
38e0d1b456 Kernel: Return ENOTSUP instead of panicking on invalid sockopt
X11 handles this gracefully, and it makes more sense than panicking.
2021-08-22 10:29:06 +02:00
Peter Elliott
ee0c6e1b6d LibC: Add <sys/poll.h> as an alias for <poll.h>
<poll.h> was originally <sys/poll.h> and some old software like X11
still uses the old path.
2021-08-22 10:29:06 +02:00
Peter Elliott
39a77559f1 Kernel+LibC: Implement FIONREAD ioctl
FIONREAD gets the number of bytes availible to read from a file
descriptor without blocking. I only implemented it for regular files and
sockets
2021-08-22 10:29:06 +02:00
Peter Elliott
db92e66902 LibC: Make <netinet/in.h> more POSIX compliant
1. Move htonl() etc. from <arpa/inet.h> to <netinet/in.h> (which
   <arpa/inet.h> includes).

   The htonl(), htons(), ntohl(), and ntohs() functions shall be
   available as described in <arpa/inet.h>.  Inclusion of the
   <netinet/in.h> header may also make visible all symbols from
   <arpa/inet.h>.

   - POSIX

2. Define IN6_IS_ADDR_LOOPBACK() and IN6_IS_ADDR_V4MAPPED()
2021-08-22 10:29:06 +02:00