Commit Graph

5415 Commits

Author SHA1 Message Date
Andreas Kling
f75a6b9daa Kernel: Demangle kernel C++ symbols correctly again
I broke this while implementing module linking. Also move the actual
demangling work to AK, in AK::demangle(const char*)
2019-11-29 14:59:15 +01:00
Andreas Kling
422e5166f2 LibC: Tolerate stddef.h being included from the kernel
This can get pulled in by <cxxabi.h>, but we don't want it pulling in
more stuff from LibC.
2019-11-29 14:53:35 +01:00
William McPherson
680fd3999e LibC: Implement bsearch
Nothing fancy, just a simple implementation of bsearch(3).
2019-11-29 11:04:01 +01:00
Andreas Kling
4ef6be8212 Kernel: Allow modules to link against anything in kernel.map :^)
We now use the symbols from kernel.map to link modules as they are
loaded into the kernel. This is pretty fricken cool!
2019-11-28 21:30:20 +01:00
Andreas Kling
1f34e16ec6 LibELF: Add ELFImage::Symbol::bind() 2019-11-28 21:29:57 +01:00
Andreas Kling
1f67894bdd Kernel: Add /proc/modules to enumerate the currently loaded modules 2019-11-28 21:12:02 +01:00
Andreas Kling
a43b115a6c Kernel: Implement basic module unloading :^)
Kernel modules can now be unloaded via a syscall. They get a chance to
run some code of course. Before deallocating them, we call their
"module_fini" symbol.
2019-11-28 21:07:22 +01:00
Andreas Kling
6b150c794a Kernel: Implement very simple kernel module loading
It's now possible to load a .o file into the kernel via a syscall.
The kernel will perform all the necessary ELF relocations, and then
call the "module_init" symbol in the loaded module.
2019-11-28 20:59:11 +01:00
Andreas Kling
c10a5ac4ad LibELF: Restore the relocation code from git history
This is going to be very useful for implementing kernel modules.
We'll also need it for dynamic linking later on.
2019-11-28 20:53:02 +01:00
Andreas Kling
0c4f29f71f LibHTML: Just swallow :not selectors for now 2019-11-28 15:01:32 +01:00
Andreas Kling
f0c94758f4 LibHTML: CSS parser should accept "foo>bar", not just "foo > bar"
If we peek a combinator at the start of a simple selector, we're seeing
the start of a new complex selector.
2019-11-28 14:48:51 +01:00
Andreas Kling
a42e477002 LibHTML: Update CSS parser with terminology from Selectors Level 4 2019-11-28 14:18:37 +01:00
Andreas Kling
75ed262fe5 Kernel+ifconfig: Add an MTU value to NetworkAdapter
This defaults to 1500 for all adapters, but LoopbackAdapter increases
it to 65536 on construction.

If an IPv4 packet is larger than the MTU, we'll need to break it into
smaller fragments before transmitting it. This part is a FIXME. :^)
2019-11-28 14:14:26 +01:00
Andreas Kling
70fadbad37 LibHTML: Respect "border-style: dotted"
Dotted borders are now painted correctly (as long as they are 1px wide)
which is yet another little improvement to my Apache2 default page :^)
2019-11-27 20:53:28 +01:00
Andreas Kling
478cfae7c8 LibDraw: Support dotted lines in Painter::draw_line()
Painter::draw_line() now has an optional "bool dotted" parameter that
causes it to only render every other pixel.

Note that this only works with horizontal and vertical lines at the
moment and we'll assert if called with dotted=true for a diagonal line.
2019-11-27 20:52:11 +01:00
Andreas Kling
5327de2df3 LibHTML: Add shorthand expansion for border-{style,width,color}
This is going to be quite boring to do by hand for every single CSS
property. We'll probably want to come up with a way to auto-generate
some/most of the shorthand expansion code.
2019-11-27 20:51:15 +01:00
Andreas Kling
d19d4da14a LibHTML: Implement compound selectors
This patch moves the Selector object model closer to the specification
objects in Selectors Level 4.

A "Selector" in LibHTML is now a { Vector<ComplexSelector> }, which is
a { Relation, CompoundSelector }. A CompoundSelector is really just
a Vector<SimpleSelector>, and SimpleSelector is "Component" renamed.

This makes a lot more selectors actually match on the Ubuntu Apache2
default homepage. :^)
2019-11-27 20:37:36 +01:00
Andreas Kling
449ebbddb6 LibGUI: Make GSortingProxyModel update the selection on resort again
After resorting, we now re-map every selected index so it matches the
new row mappings. This makes the process table view in SystemMonitor
behave normally again :^)
2019-11-27 19:04:35 +01:00
Andreas Kling
23a2e84873 Kernel: listen() should fail with EINVAL for already-connected sockets
This according to POSIX.
2019-11-27 16:01:22 +01:00
Andreas Kling
66a9c233be Kernel: Remove Process::state(), everyone should use Thread::state() 2019-11-27 15:31:50 +01:00
Andreas Kling
bd86ebbcc0 Kernel: Remove outdated FIXME about EINTR in select()
This is actually already implemented. :^)
2019-11-27 15:31:23 +01:00
Andreas Kling
0adbacf59e Kernel: Demangle userspace ELF symbols in backtraces
Turns out we can use abi::__cxa_demangle() for this, and all we need to
provide is sprintf(), realloc() and free(), so this patch exposes them.

We now have fully demangled C++ backtraces :^)
2019-11-27 14:06:24 +01:00
Andreas Kling
2d1bcce34a Kernel: Fix triple-fault when clicking on SystemServer in SystemMonitor
The fault was happening when retrieving a current backtrace for the
SystemServer process.

To generate a backtrace, we go into the paging scope of the process,
meaning we temporarily switch to using its page directory as our own.

Because kernel VM is allocated on demand, it's possible for a process's
mappings above the 3GB mark to be out-of-date. Normally this just gets
fixed up transparently by the page fault handler (which simply copies
the PDE from the canonical MM.kernel_page_directory() into the current
process.)

However, if the current kernel *stack* is in a piece of memory that
the backtraced process lacks up-to-date PDE's for, we still get a page
fault, but are unable to handle it, since the CPU wants to push to the
stack as part of calling the page fault handler. So we're screwed and
it's a triple-fault.

Fix this by always updating the kernel VM mappings before switching
into a paging scope. In practical terms, this is a 1KB memcpy() that
happens when generating a backtrace, or doing exec().
2019-11-27 12:40:42 +01:00
Andreas Kling
5b8cf2ee23 Kernel: Make syscall counters and page fault counters per-thread
Now that we show individual threads in SystemMonitor and "top",
it's also very nice to have individual counters for the threads. :^)
2019-11-26 21:37:38 +01:00
Andreas Kling
712ae73581 Kernel: Expose per-thread information in /proc/all
Previously it was not possible to see what each thread in a process was
up to, or how much CPU it was consuming. This patch fixes that.

SystemMonitor and "top" now show threads instead of just processes.
"ps" is gonna need some more fixing, but it at least builds for now.

Fixes #66.
2019-11-26 21:37:30 +01:00
Andreas Kling
86a9a52355 Kernel: Process::for_each_thread() should show the main thread of PID 0 2019-11-26 21:25:11 +01:00
Sergey Bugaev
fe0aa2ca53 Base: Document SystemServer 2019-11-26 19:58:25 +01:00
Sergey Bugaev
52b0bd06a8 SystemServer: Implement lazy spawning
For services explicitly configured as lazy, SystemServer will now listen
on the socket and only spawn the service once a client attempts to connect
to the socket.
2019-11-26 19:58:25 +01:00
Sergey Bugaev
ab98969403 LookupServer: Port to socket takeover 2019-11-26 19:58:25 +01:00
Sergey Bugaev
821ed8367b LookupServer: Port to LibCore 2019-11-26 19:58:25 +01:00
Sergey Bugaev
9eaac26eda ProtocolServer: Port to socket takeover 2019-11-26 19:58:25 +01:00
Sergey Bugaev
bd55938985 AudioServer: Port to socket takeover 2019-11-26 19:58:25 +01:00
Sergey Bugaev
22a05621d5 WindowServer: Port to socket takeover 2019-11-26 19:58:25 +01:00
Sergey Bugaev
c9e21b2bcc SystemServer+LibCore: Implement socket takeover
SystemServer can now create sockets on behalf of services before spawning any
of them, and pass the open socket fd as fd 3. CLocalServer gains a method to
complete the takeover and listen on the passed fd.

This is not used by any services at the moment.
2019-11-26 19:58:25 +01:00
Sergey Bugaev
396ad4d6b2 SystemServer: Implement keepalive
When reaping a child, SystemServer will now match up child's pid with its own
record of the services, and respawn the service if keepalive is enabled for it.

For example, we want to restart the WindowServer if it crashes, but we wouldn't
want to restart the Terminal if it gets closed.
2019-11-26 19:58:25 +01:00
Sergey Bugaev
b93065359e SystemServer: Read service list from a config file
This replaces the hardcoded services list with a very simple config
file in /etc/SystemServer.ini :^)

Closes https://github.com/SerenityOS/serenity/issues/610
2019-11-26 19:58:25 +01:00
Sergey Bugaev
2f9be662ef LibCore: Assert instead of crashing in CEventLoop::current() 2019-11-26 19:58:25 +01:00
Sergey Bugaev
8aef0a0755 Kernel: Handle fstat() on sockets 2019-11-26 19:58:25 +01:00
Sergey Bugaev
b64cee4589 LibC: Remove a leftover default_stream
Long ago, there was a fourth stdio default stream, stddbg, connected to the
debug console. It has since been replaced by the dbgputstr() and dbgputch()
syscalls.

3fce2fb205

Remove the last remains of stddbg, as fd 3 is soon going to be reused for socket
takeover.
2019-11-26 19:58:25 +01:00
Andreas Kling
9a6d506ac8 ps: Show "/dev/pts/0" as "pts/0" instead of "0"
Also tweak the alignment of the output a bit.
2019-11-26 15:01:46 +01:00
Andreas Kling
aa49419173 LibCore: Make CFile::open() truncate when opening something "WriteOnly"
Unless we're also opening to append (and/or if the file is required to
be a new file), CFile::open(WriteOnly) will now truncate the file.
2019-11-26 14:32:59 +01:00
Andreas Kling
67d2875d60 Build: Bump the default disk image size from 500MB to 600MB
This gives us a little more leeway for installing ports, etc.
2019-11-26 12:54:33 +01:00
Andreas Kling
6d1c4ae5a9 LibHTML: Implement basic <form> and <input> element support
This patch adds "submit" inputs and default (text box) inputs, as well
as form elements that can be submitted.

Layout of input elements is implemented via a new LayoutWidget class
that allows you to put an arbitrary GWidget in the layout tree.
At the moment, the DOM node sets the initial size of the LayoutWidget,
and then the positioning is done by the normal layout algorithm.

We also now support submitting a <form method="GET">, which does a full
replacing load with a URL based on the form's action + a query string
built from the name/value of input elements within the submitted form.

This is pretty neat! :^)
2019-11-25 21:21:55 +01:00
Andreas Kling
a91c17c0eb AK: Add a query string component to URL
It's missing query string parsing from new URLs, but you can set the
query string programmatically, and it will be part of the URL when
serialized through to_string().
2019-11-25 21:21:27 +01:00
Andreas Kling
8dc6f7cd4f LibHTML: Give Frame a (weak) back-pointer to the HtmlView
This will be the official path from DOM/layout code to the HtmlView
for now. Perhaps in the future we will have a fancier abstraction.
2019-11-25 21:19:21 +01:00
Andreas Kling
94bc46ee70 LibHTML: Improve CSS parser's handling of values somewhat
Now we just skip over url() and rgb() instead of crashing on them.
2019-11-25 20:04:04 +01:00
Andreas Kling
847b232680 LibHTML: Divide the "line spacing" evenly between lines of text
Before this patch, all of the excess spacing caused by line-height was
"padding" the line boxes below the text.

To fix this, we make line box fragments use the font height as their
height, and then let the inline layout algorithm adjust the Y positions
to distribute the vertical space.
2019-11-25 18:14:52 +01:00
Andreas Kling
10d67879c3 Base: Import the 1st and 2nd Acid tests for web standards compliance
Getting these to work will take a lot of work, but most of it will be
pretty fun, so I guess we start by importing them. :^)
2019-11-25 17:48:51 +01:00
Andreas Kling
320c79cb48 LibHTML: Join border edges nicely when painting boxes
Always paint border edges so they join nicely with their buddy edges.
This makes borders look nice even if all sides have different widths.

Also switch the border code to using floating point numbers since
otherwise things get very ugly very fast.
2019-11-25 14:37:04 +01:00
Andreas Kling
05b1ecf1b1 LibHTML: Draw each CSS border edge separately with their own style
The borders still look very wrong with any border-width other than 1,
but at least we can see that they have the right color, and end up in
mostly the right place :^)
2019-11-25 13:17:14 +01:00