Commit Graph

2490 Commits

Author SHA1 Message Date
Andreas Kling
c048ded470 Kernel: Dump backtrace on illegal opcode exception. 2019-05-22 13:22:27 +02:00
Andreas Kling
e388808479 LibC: Some compat fixes for GNU make. 2019-05-22 13:21:49 +02:00
Andreas Kling
f490ce0fb5 LibC: Implement wait() as a wrapper around waitpid(). 2019-05-22 13:21:17 +02:00
Andreas Kling
4aef87a9a4 LibC: First pass of compat work / stubs while trying to build OpenSSL. 2019-05-21 21:36:08 +02:00
Andreas Kling
08228f34b9 GWindow: Only flip the window backing stores once per paint event. 2019-05-21 21:05:10 +02:00
Robin Burchell
9aa9454c6b WindowServer: Don't eat a MouseUp when producing a MouseDoubleClick
Otherwise, double clicking a button will leave it in pressed state.
2019-05-21 16:43:56 +02:00
Andreas Kling
c9a9ca0dfe Kernel: Bump kernel stacks to 64 KB.
This makes the ELF symbolication crash go away while I work out a smart fix.
2019-05-21 16:15:52 +02:00
Andreas Kling
a8313ae0a3 AK: Always inline convert_between_host_and_network<T>. 2019-05-21 16:14:02 +02:00
Andreas Kling
e383bc6fd8 LibC: Oops, forgot to commit sigsuspend() prototype. 2019-05-21 12:31:14 +02:00
Andreas Kling
3c7b46a85a LibC: Add htonl() and ntohl(). 2019-05-21 02:22:21 +02:00
Andreas Kling
02033873b7 LibC: Add sigsuspend() stub. 2019-05-21 02:22:02 +02:00
Andreas Kling
52f135fe13 AK: Add some more features to Vector iterators. 2019-05-21 01:36:36 +02:00
Andreas Kling
ae470ec955 Kernel: Add getpeername() syscall, and fix getsockname() behavior.
We were copying the raw IPv4 addresses into the wrong part of sockaddr_in,
and we didn't set sa_family or sa_port.
2019-05-20 20:33:03 +02:00
Andreas Kling
f008156dbf Socket: Fix missing kprintf() args in setsockopt(). 2019-05-20 19:45:27 +02:00
Andreas Kling
9df8d28542 WindowServer: Don't start window resize for MouseUp or MouseMove. 2019-05-20 11:06:10 +02:00
Andreas Kling
bcc6ddfb6b Kernel: Let PageDirectory own the associated RangeAllocator.
Since we transition to a new PageDirectory on exec(), we need a matching
RangeAllocator to go with the new directory. Instead of juggling this in
Process and MemoryManager, simply attach the RangeAllocator to the
PageDirectory instead.

Fixes #61.
2019-05-20 04:46:29 +02:00
Andreas Kling
d65114afd7 WindowServer: Convert some assertions into client did_misbehave()'s. 2019-05-20 04:29:07 +02:00
Andreas Kling
091448b8f3 WindowServer: Use blocking sockets for client connections. 2019-05-20 04:08:09 +02:00
Andreas Kling
5023464d95 LocalSocket: Make send() and sendto() work, too. 2019-05-20 03:59:30 +02:00
Andreas Kling
668bfaa2af LocalSocket: Bump internal buffer sizes to 16KB.
This gives us some leeway for WindowServer to queue up a bunch of messages
for one of its clients. Longer-term we should improve DoubleBuffer to be
able to grow dynamically in a way that gets billed to some reasonable place.
2019-05-20 03:57:25 +02:00
Andreas Kling
dc03b50f41 GEventLoop: Make the WindowServer connection use a blocking socket. 2019-05-20 03:47:50 +02:00
Andreas Kling
b3a1671f1a Kernel: Add support for recv() with MSG_DONTWAIT.
Passing this flag to recv() temporarily puts the file descriptor into
non-blocking mode.

Also implement LocalSocket::recv() as a simple forwarding to read().
2019-05-20 03:47:02 +02:00
Andreas Kling
0b850cf726 WindowServer: Allow sending up to 32 invalidation rects inline.
Oops, it looks like I left the max inline rects limit at 1 while debugging
this code.. We can fit 32 rects in a single WSAPI message without needing
a second "extra data" message, so let's use the space we have!
2019-05-20 03:18:43 +02:00
Robin Burchell
d791bce6af CEventLoop: Allow manually driving the event loop
Move the bulk of exec() into a new pump(). Since SDL wants to drive the
event loop itself, this is a requirement. We also add a WaitMode flag to
allow for immediately pumping events -- again, this is required because
SDL wants to be in full control of the event loop, and not let us wait.
2019-05-20 03:03:48 +02:00
Andreas Kling
85d2e85912 LocalSocket: Fix mismatch between can_write() and write() logic.
can_write() was saying yes in situations where write() would overflow the
internal buffer. This patch adds a has_attached_peer() helper to make it
easier to understand what's going on in these functions.
2019-05-20 02:54:52 +02:00
Andreas Kling
612e1c7023 Toolchain: Oops, let's unbreak UseIt.sh. 2019-05-20 02:06:41 +02:00
Robin Burchell
a8864dc590 Kernel: Report EAGAIN from read() on a non-blocking socket if the buffer is empty
This is not EOF, and never should have been so -- can trip up other code
when porting.

Also updates LibGUI and WindowServer which both relied on the old
behaviour (and didn't work without changes). There may be others, but I
didn't run into them with a quick inspection.
2019-05-20 01:31:28 +02:00
Robin Burchell
40a5eb4e6e Minesweeper: Make things a little more friendly at the start
Rather than having the first click hit a bomb, if the first click would
hit a bomb, instead, reset the game board.

This is a (sort of) feature of Windows minesweeper, and IMO makes
playing a bit more fun :-)
2019-05-19 21:33:50 +02:00
Andreas Kling
5b6e66195b LibC: Add an h_addr macro for old code that doesn't know about h_addr_list. 2019-05-19 19:55:49 +02:00
Andreas Kling
212a263f0a Kernel+LibC: Implement getsockname() syscall. 2019-05-19 19:55:27 +02:00
Andreas Kling
0eb788d641 LibC: Add stub for fsync(). 2019-05-19 19:54:20 +02:00
Andreas Kling
189b342e6f LibC: Add mmap_with_name() that names the allocation immediately.
This allows us to skip the separate call to set_mmap_name() in code that
we control, e.g malloc() and GraphicsBitmap.
2019-05-19 15:54:56 +02:00
Andreas Kling
5f26f83451 IDEDiskDevice: Add sysctl variable for turning DMA on/off. 2019-05-19 15:54:33 +02:00
Andreas Kling
29863d3815 LibC: unsetenv() should take a const char*, not a char*. 2019-05-19 15:19:48 +02:00
Robin Burchell
5f597d0cb2 WindowServer: Improve client write handling a little
* EPIPE now correctly deletes the client connection
* EAGAIN (which is now returned by the kernel if the write buffer fills)
  terminates the connection also
2019-05-19 14:13:49 +02:00
Robin Burchell
d8b74c8c86 Kernel: Check can_write for blocking write
This way the socket write buffer sizes are respected, and things that
exceed them get sent EAGAIN.
2019-05-19 14:13:49 +02:00
Robin Burchell
635eb20289 Kernel: Add the ability to debug poll/select independently of read/write 2019-05-19 14:13:49 +02:00
Andreas Kling
c7d8aa6969 IDEDiskDevice: Support reading multiple sectors at a time with DMA.
This is another sizable improvement to GCC compile times.
2019-05-19 04:40:30 +02:00
Andreas Kling
ed79116e94 IDEDiskDevice: Use wait_for_irq() when waiting for DMA transfers.
Also make sure we return any device errors to caller.
2019-05-19 03:56:06 +02:00
Andreas Kling
c818773983 IDEDiskDevice: Add support for DMA reads.
I've only tested this with the PIIX3 chipset QEMU emulates, but it works
pretty well here. GCC compile times are cut roughly in half :^)
2019-05-19 03:46:50 +02:00
Andreas Kling
1fd90b09f8 Kernel: Remove an unused ELFLoader member. 2019-05-19 02:03:56 +02:00
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