Andreas Kling
d5508e5116
Ext2FS: Avoid a lot of redundant writes to inode block arrays.
2019-03-27 14:24:37 +01:00
Andreas Kling
750d79dcaf
Kernel: Initialize the CPU to allow SSE on startup.
...
I still need to add support for SSE to the context switching code, but now
at least one process can use it.
2019-03-27 13:40:00 +01:00
Andreas Kling
5808322556
Give the emulator testing environments 128 MB of RAM.
...
I'm working on porting GCC and it needs a fair bit of memory to run.
2019-03-27 13:02:29 +01:00
Andreas Kling
23bb276fcd
LibC: Run constructors on process startup.
...
Cooperate with the compiler to generate and execute the _init_array list
of constructor functions on userspace program statup. This took two days
to get working, my goodness. :^)
2019-03-27 12:48:21 +01:00
Andreas Kling
75207ddffd
Kernel: Load ELF executable pages lazily when possible.
...
This currently only works for "normal" processes created by fork().
It does not work for create_user_process() processes spawned by the
kernel, as those are a bit special during construction.
2019-03-27 04:01:15 +01:00
Andreas Kling
abd5931184
Kernel: Print an error when trying to load an incompatible ELF image.
2019-03-27 01:29:49 +01:00
Andreas Kling
500df578fe
LibGUI+Kernel: Add a GLock class (userspace mutex.)
...
It's basically a userspace port of the kernel's Lock class.
Added gettid() and donate() syscalls to support the timeslice donation
feature we already enjoyed in the kernel.
2019-03-25 13:03:49 +01:00
Andreas Kling
ab11f42094
Kernel: Do timekeeping manually instead of asking the RTC all the time.
...
This introduces a tiny amount of timer drift which I will have to fix
somehow eventually, but it's a huge improvement in timing consistency
as we no longer suddenly jump from e.g 10:45:49.123 to 10:45:50.000.
2019-03-25 02:06:57 +01:00
Andreas Kling
e7c1caa2b5
Kernel: Don't hang the system on unrecoverable page fault.
...
I needed this while debugging threads and now they basically work pretty
well so we can remove this. :^)
2019-03-24 02:11:07 +01:00
Andreas Kling
239c0bd6a6
Kernel: Make block() and yield() automatically call Scheduler::yield().
...
This exposed some places we were accidentally doing a double yield().
2019-03-24 01:52:10 +01:00
Andreas Kling
5713c3a0cb
Kernel: Fix broken destruction order for Process/Thread.
2019-03-24 01:20:35 +01:00
Andreas Kling
fa7f532c35
Kernel: Add a Thread::all_threads() helper.
2019-03-23 23:50:49 +01:00
Andreas Kling
e561ab1b0b
Kernel+LibC: Add a simple create_thread() syscall.
...
It takes two parameters, a function pointer for the entry function,
and a void* argument to be passed to that function on the new thread.
2019-03-23 22:59:08 +01:00
Andreas Kling
6416123cfb
Kernel: Set the colonel task to low priority.
...
This gives it a smaller time slice, improving responsiveness.
2019-03-23 22:22:01 +01:00
Andreas Kling
8501fdc6f5
Kernel: Don't add the colonel process' main thread to g_threads.
...
This was causing the colonel to get scheduled when he wasn't needed.
2019-03-23 22:17:38 +01:00
Andreas Kling
60d25f0f4a
Kernel: Introduce threads, and refactor everything in support of it.
...
The scheduler now operates on threads, rather than on processes.
Each process has a main thread, and can have any number of additional
threads. The process exits when the main thread exits.
This patch doesn't actually spawn any additional threads, it merely
does all the plumbing needed to make it possible. :^)
2019-03-23 22:03:17 +01:00
Andreas Kling
9dfcd95cd7
Use 64-bit integers inside Stopwatch to enable longer timings.
2019-03-21 13:41:36 +01:00
Andreas Kling
42755e98cf
SharedGraphics: Implement a simple PNG decoder.
...
This is extremely unoptimized, but it does successfully load "folder32.png"
so it must be at least somewhat correct. :^)
2019-03-21 03:57:42 +01:00
Andreas Kling
86e2348b74
Kernel+LibC: Don't crash upon traversal of large directories.
2019-03-20 18:31:12 +01:00
Andreas Kling
7b32afdcfc
Kernel: Oops, forgot to add Alarm.h earlier. Here it is.
2019-03-20 18:16:15 +01:00
Andreas Kling
367bb9e4eb
Kernel: Remove ioctl for getting a socket peer's PID.
...
Now that everything is nice and mature, the WindowServer can just use the
client PID it receives in the Greeting message, and we can get rid of this
hacky ioctl. :^)
2019-03-20 17:14:48 +01:00
Andreas Kling
bc1da7f1fd
Kernel: Snooze the NetworkTask until there are incoming packets to process.
...
This is accomplished using a new Alarm class and a BlockedSnoozing state.
Basically, you call Process::snooze_until(some_alarm) and then the scheduler
won't wake up the process until some_alarm.is_ringing() returns true.
2019-03-20 17:09:46 +01:00
Andreas Kling
d17a91f185
Move WindowServer into Servers.
2019-03-20 04:34:14 +01:00
Andreas Kling
9120b05a40
Rename DNSLookupServer => LookupServer.
2019-03-20 04:26:30 +01:00
Andreas Kling
41c744b3c8
Kernel: Don't panic if a call redirected to Device::open() has an error.
...
Just pass the error to the user. I hit this when opening so many Terminal
windows that PTYMultiplexer::open() ran out of master/slave pairs.
2019-03-20 02:55:12 +01:00
Andreas Kling
6f966ca51d
Kernel: Accepting sockets don't need to retain the client sockets.
...
This is all taken care of by the respective FileDescriptors.
Before this patch, we were leaking every single socket, not great!
2019-03-20 02:48:02 +01:00
Andreas Kling
e48cbf3c8c
Kernel: connect() should fail with EISCONN for already-connected sockets.
...
Also make sure to reset the socket role if Socket::connect() fails.
2019-03-20 02:38:36 +01:00
Andreas Kling
4aa0ab4e08
Kernel: Fix race between accept() and connect().
...
We had a bug where an accepted socket would appear to be EOF/disconnected
on the accepting side until the connecting side had called attach_fd().
Fix this by adding a new SocketRole::Connecting state.
2019-03-20 02:33:51 +01:00
Andreas Kling
a02c945ef2
Kernel: DoubleBuffer can return early if read/write is called with !size.
2019-03-20 02:12:40 +01:00
Andreas Kling
0e4a1936ca
LibC: Implement gethostbyname() by talking to the DNSLookupServer.
...
We now talk to the lookup server over a local socket and it does the lookup
on our behalf. Including some retry logic, which is nice, because it seems
like DNS requests disappear in the ether pretty damn often where I am.
2019-03-20 01:15:22 +01:00
Andreas Kling
fe2fa4ac80
DNSLookupServer: Start working on a userspace DNS resolver.
...
This doesn't have any server functionality just yet, but it does post
decent-looking DNS queries and parse the responses.
2019-03-19 16:29:06 +01:00
Andreas Kling
57ff293a51
LibGUI: Implement nested event loops to support dialog boxes.
...
This patch adds a simple GMessageBox that can run in a nested event loop.
Here's how you use it:
GMessageBox box("Message text here", "Message window title");
int result = box.exec();
The next step is to make the WindowServer respect the modality flag of
these windows and prevent interaction with other windows in the same
process until the modal window has been closed.
2019-03-19 00:01:02 +01:00
Andreas Kling
8e3d0a23d5
LibGUI: Add GTCPSocket and base class GSocket (inherits from GIODevice.)
...
And use these to do the line-by-line reading automagically instead of having
that logic in IRCClient. This will definitely come in handy.
2019-03-18 14:09:58 +01:00
Andreas Kling
c24d4b07db
IPv4: Add simple pseudorandom ephemeral port allocators for TCP and UDP.
2019-03-18 04:03:44 +01:00
Andreas Kling
1c6dfc3282
AK: Make ByteBuffer's copy() and wrap() take void*.
...
This way we don't have to cast whatever we're passing to copy()/wrap().
2019-03-17 00:36:41 +01:00
Andreas Kling
5dd79736c5
Kernel: Remove the one client of Vector-with-custom-allocator.
...
This was a silly experiment. If I want to save space here, I can do it in
one of many other ways.
2019-03-16 13:19:58 +01:00
Andreas Kling
313ee8dd19
Move Lock from AK to Kernel, since it only works inside the kernel.
2019-03-16 13:18:22 +01:00
Andreas Kling
15657f0916
AK: Remove Buffer<T> since it was only ever instantiated with T=byte.
...
Instead make a specialized AK::ByteBufferImpl class for the backing store
of AK::ByteBuffer. This reduces template bloat.
2019-03-16 13:12:13 +01:00
Andreas Kling
aa19735c5a
IRCClient: Start working on a simple graphical IRC client.
...
This will be a nice way to exercise both LibGUI and the TCP/IP support. :^)
2019-03-15 12:14:23 +01:00
Andreas Kling
5dfdcf796d
TCP: Correct checksum for packets with odd number of bytes.
2019-03-14 19:57:54 +01:00
Andreas Kling
f9569db1e5
TCP: Collect the payload if present in a packet with FIN set.
2019-03-14 15:28:23 +01:00
Andreas Kling
25e521f510
TCP: Start working on auto-closing connections when we get FIN.
2019-03-14 15:23:32 +01:00
Andreas Kling
69ffaa366d
Kernel: Handle unaligned ELF segments gracefully in the executable loader.
2019-03-14 14:51:43 +01:00
Andreas Kling
d712d353ac
Kernel: Remove leftover debug spam when returning from mkdir() syscall.
2019-03-14 14:11:35 +01:00
Andreas Kling
edb986c276
IPv4: Factor out UDP parts of IPv4Socket into a UDPSocket class.
2019-03-14 12:43:18 +01:00
Andreas Kling
274b500bac
IPv4: Move more stuff from IPv4Socket to TCPSocket.
2019-03-14 12:28:30 +01:00
Andreas Kling
d2176eddfc
Kernel: Factor out TCP parts of IPv4Socket into a TCPSocket class.
2019-03-14 12:20:38 +01:00
Andreas Kling
8014473918
TCP: Update our side's ack number based on the other side's seq number.
2019-03-14 11:45:22 +01:00
Andreas Kling
54e7df0586
Kernel: Add SocketHandle helper class that wraps locked sockets.
...
This allows us to have a comfy IPv4Socket::from_tcp_port() API that returns
a socket that's locked and safe to access. No need to worry about locking
at the client site.
2019-03-14 09:19:24 +01:00
Andreas Kling
3d5296a901
IPv4: Last burst of TCP hacking for today.
...
Connecting to a test server and exchanging data back and forth works.
2019-03-14 01:44:42 +01:00