Commit graph

2549 commits

Author SHA1 Message Date
Andreas Kling
6e305bf838 AK: Simplify quick_sort() and improve Vector iterators a bit. 2019-05-19 01:53:51 +02:00
Andreas Kling
853597200e Kernel: Remove relocation-related code since it's not used by the kernel.
If/when we need this in the future, we can bring it back. Right now it's
just sitting there making the ELF code look huge when it's not.
2019-05-19 01:14:32 +02:00
Andreas Kling
75866438b5 Kernel: Don't page in entire file immediately on mmap().
If we just don't do anything, the page fault handler will load the file
incrementally as-needed instead. :^)
2019-05-18 22:30:55 +02:00
Andreas Kling
f5234660f6 malloc: Use a Vector with inline capacity for the big block recyclers. 2019-05-18 22:26:01 +02:00
Andreas Kling
959c8f287c FileDescriptor: It's actually okay to seek past the end of a file. :^) 2019-05-18 21:54:31 +02:00
Andreas Kling
7900da9667 Kernel: Make sure we never put the colonel thread in the runnable list.
This would cause it to get scheduled unnecessarily.
2019-05-18 20:28:04 +02:00
Andreas Kling
64a4f3df69 Kernel: Add a Thread::set_thread_list() helper to keep logic in one place. 2019-05-18 20:28:04 +02:00
Andreas Kling
8c7d5abdc4 Kernel: Refactor thread scheduling a bit, breaking it into multiple lists.
There are now two thread lists, one for runnable threads and one for non-
runnable threads. Thread::set_state() is responsible for moving threads
between the lists.

Each thread also has a back-pointer to the list it's currently in.
2019-05-18 20:28:04 +02:00
Robin Burchell
99dd60611f Kernel: Fix select with a 0 timeout
select essentially has 3 modes (which is presumably why we're finding it
so hard to get this right in a reliable way :)).

1. NULL timeout -- no timeout on blocking
2. non-NULL timeout that is not zero'd -- timeout on blocking
3. non-NULL but zero timeout -- no blocking at all (immediate poll)

For cases 1 and 2, we want to block the thread. We have a timeout set
only for case 2, though.

Case 3 should not block the thread, and does not have a timeout set.
2019-05-18 19:01:08 +02:00
Andreas Kling
d2c3749cf3 Kernel: Don't allow dump_backtrace() to call dump_backtrace().
That was not a very graceful looking loop to be stuck in.
2019-05-18 17:33:05 +02:00
Robin Burchell
ec0d598934 WSWindowManager: Add double click to maximize/restore 2019-05-18 15:54:10 +02:00
Andreas Kling
316fb624f7 Kernel: Fail a bit more gracefully when we don't have userspace symbols. 2019-05-18 14:49:49 +02:00
Andreas Kling
a4e48dce77 Kernel: SharedMemory should implement mmap(). 2019-05-18 04:17:53 +02:00
Andreas Kling
237628a7a6 Kernel: Tidy up FileDescriptor members a bit. 2019-05-18 04:14:22 +02:00
Robin Burchell
123283d840 Kernel: Fix poll() with timeout 2019-05-18 04:03:28 +02:00
Andreas Kling
b33cc7f772 Kernel: Remove some RangeAllocator debug spam. 2019-05-18 03:59:16 +02:00
Andreas Kling
cdaf8cd656 Kernel: select() was transferring the readfds into the exceptfds vector.
Just a mistake I spotted while reading the code. We don't actually detect
exceptional descriptor events yet.
2019-05-18 03:09:37 +02:00
Andreas Kling
14c896ec58 Kernel: Pass ELF program header locations from multiboot to kernel.
Patch contributed by "pd"
2019-05-18 03:08:29 +02:00
Robin Burchell
ba92c07a75 Kernel: Make sure to clear FD sets when preparing for a select
NULL sets can happen, and we don't want to incorrectly return FDs which
aren't in the set too.
2019-05-18 02:57:38 +02:00
Robin Burchell
95893b0d53 Toolchain: Add some required options to the default CMake options. 2019-05-18 02:57:38 +02:00
Robin Burchell
df74a9222f Kernel: Fix timeout support in select
The scheduler expects m_select_timeout to act as a deadline. That is, it
should contain the time that a task should wake at -- but we were
directly copying the time from userspace, which meant that it always
returned virtually immediately.

At the same time, fix CEventLoop to not rely on the broken select behavior
by subtracting the current time from the time of the nearest timer.
2019-05-18 02:57:38 +02:00
Andreas Kling
8f3022b5c1 NetworkTask: Don't crash on startup if there's no E1000 NIC present. 2019-05-18 00:22:08 +02:00
Andreas Kling
33d0916d29 WindowServer: Add support for fullscreen windows.
Fullscreen windows are rendered alone and above everything else when they
are active, and as part of the regular window stack order when something
else is active.

Currently windows cannot be made fullscreen after-the-fact, but must have
the fullscreen flag included in their CreateWindow message.

It should not possible to interact with the menu, taskbar or window frame
while the active window is fullscreened. :^)
2019-05-17 22:33:19 +02:00
Robin Burchell
5babcac289 Build: Install most headers to Root (and libcore.a/libgui.a)
This makes out-of-tree linking possible. And at the same time, add a
CMakeToolchain.txt file that can be used to build arbitrary cmake-using
applications on Serenity by pointing to the CMAKE_TOOLCHAIN_FILE when
running cmake:

    -DCMAKE_TOOLCHAIN_FILE=~/code/serenity/Toolchain/CMakeToolchain.txt
2019-05-17 21:59:48 +02:00
Andreas Kling
2d98f4e28f Kernel: Make the times() syscall return something other than 0.
Based on the description I read, this syscall doesn't seem completely
reasonable, but let's at least return a number that is likely to change
between invocations in case somebody depends on that happening.
2019-05-17 20:19:29 +02:00
Andreas Kling
f015798af9 LibC: Implement clock() and add CLOCKS_PER_SEC define. 2019-05-17 20:19:03 +02:00
Andreas Kling
a182ea8c60 Kernel: After creating our GDT, make sure CS refers to the right descriptor.
This will allow us to boot from e.g GRUB which will have a different looking
GDT in effect before we start moving things around.
2019-05-17 18:52:29 +02:00
Andreas Kling
64b0b81b2a sync.sh: Use mkdir -p for everything. 2019-05-17 18:26:54 +02:00
Andreas Kling
e8ae2c952e Kernel: Put GDT and IDT in BSS rather than runtime-allocating them. 2019-05-17 18:25:50 +02:00
Andreas Kling
e0ff07bb57 Kernel: Make sure we load DS/ES/FS/GS/SS immediately after making the GDT. 2019-05-17 18:23:08 +02:00
Andreas Kling
a15857ea28 Kernel: Clear the X86 direction flag (DF) in the boot loader.
I'm not sure who is responsible for clearing this, but IIUC the C++ ABI
expects it to be clear on function entry, so just to be on the safe side..
2019-05-17 18:20:11 +02:00
Andreas Kling
45230a9544 Run QEMU with the "guest_errors" debug flag, in case we do something wrong. 2019-05-17 18:19:03 +02:00
Andreas Kling
923e587283 Kernel: GDTR and IDTR limits should be table size - 1. 2019-05-17 18:17:53 +02:00
Robin Burchell
0d77aa841a Kernel/Process: Use auto to avoid incompatible types, causing a signedness warning in the ASSERT 2019-05-17 16:06:26 +02:00
Robin Burchell
1cefb4a3b4 Kernel/RTC: Mark some intentional fallthroughs to suppress compiler warnings 2019-05-17 16:06:26 +02:00
Robin Burchell
20e55c0120 GInputBox: Use whichever is greater: the approximate size of the title, or the label's text
Might be an idea to add a minimum size constrain in window server
instead, since it knows the exact dimensions? But this is a simple fix
that seems to do the job.
2019-05-17 15:54:16 +02:00
Robin Burchell
77dfd419e9 LibCore: Move AK/ArgsParser to LibCore/CArgsParser
Also rename the classes to match LibCore naming style.
This means that it's no longer incorrectly linked into LibC and Kernel.
2019-05-17 15:49:37 +02:00
Robin Burchell
190111e21a Userland: Port ln to use ArgsParser 2019-05-17 15:49:37 +02:00
Robin Burchell
bffed9e3cb ArgsParser: Expand to be able to handle multiple single arguments
This is needed for e.g. ln
2019-05-17 15:49:37 +02:00
Robin Burchell
b92fa59832 Userland: Port pape to use ArgsParser, and minor cleanups 2019-05-17 15:49:37 +02:00
Robin Burchell
56aad835ad Userland: Port sysctl to use ArgsParser, and minor cleanups 2019-05-17 15:49:37 +02:00
Robin Burchell
6dd7ee53ea AK/Userland: Add single value to ArgsParser usage, and port tail to use ArgsParser 2019-05-17 15:49:37 +02:00
Robin Burchell
c478503581 ArgsParser: Remove prefix from constructor
It makes sense to keep this consistent between applications, and the
purpose of the string is not immediately obvious from an API perspective.

If we need to make it configurable later, that can come from a setter.
2019-05-17 15:49:37 +02:00
Robin Burchell
729507f2bd ArgsParser: Remove boolean trap on add_arg
Rather than requiring a boolean for whether or not the argument is
required, add some new methods to make the purpose of the bool explicit.
2019-05-17 15:49:37 +02:00
Robin Burchell
5cad215919 ArgsParser: Style fixup
Remove tabs, make whitespace lines a little more in fitting with the rest of the codebase.
2019-05-17 15:49:37 +02:00
Andreas Kling
3ec625067a Terminal: Uh, also change the one caller of beep() to sysbeep().. 2019-05-17 14:34:07 +02:00
Andreas Kling
c081aae9b5 LibC: Rename beep() to sysbeep() to avoid clashing with curses. 2019-05-17 14:32:53 +02:00
Robin Burchell
c8fda23a03 LibCore/Userland: Introduce a simple tail implementation
Also introduce more seek modes on CIODevice, and an out param to find
the current position inside the file -- this means less syscalls (and
less potential races) than requesting it through a separate pos()
accessor or something.
2019-05-17 14:28:13 +02:00
Robin Burchell
805e87a21c WindowServer: Add a more dynamic app list
This contains more stuff, and is easier to add to since it's just a vector :)
2019-05-17 14:20:44 +02:00
Andreas Kling
cc5ee3bff4 Vector: Add insert() overload that takes a const T&. 2019-05-17 04:59:56 +02:00