Andreas Kling
5e8e554f94
Add a braindead 10x speedup to kmalloc().
...
Skip over entirely full buckets when scanning for a big-enough memory slot.
This means I can postpone writing a better kmalloc() for a while longer! :^)
2018-11-12 15:29:46 +01:00
Andreas Kling
dea474dfd5
Make loading /bin/bash ~250x faster.
...
The ELF loader was doing huge amounts of unnecessary work.
Got rid of the "export symbols" and relocation passes since we don't need them.
They were useful things when bringing up the ELF loading code.
Also added a simple TSC-based Stopwatch RAII thingy to help debug performance issues.
2018-11-12 13:45:15 +01:00
Andreas Kling
1cf20a2fe2
Some minor termios debugging output.
2018-11-12 12:27:28 +01:00
Andreas Kling
f1404aa948
Add primitive FIFO and hook it up to sys$pipe().
...
It's now possible to do this in bash:
cat kernel.map | fgrep List
This is very cool! :^)
2018-11-12 01:28:46 +01:00
Andreas Kling
18e3ddf605
Add a naive /bin/fgrep for testing pipes.
2018-11-11 20:42:41 +01:00
Andreas Kling
d5d45d1088
Rage hacking to get bash to run. It finally runs. So cool! :^)
2018-11-11 15:38:07 +01:00
Andreas Kling
9b70808ab5
Add really cheap atol() since sizeof(int) == sizeof(long) here anyway.
2018-11-11 10:40:50 +01:00
Andreas Kling
f394e3486a
Stub out a bunch more functions to get closer to that sweet bash build.
2018-11-11 10:38:33 +01:00
Andreas Kling
e48182d91b
Add setvbuf(), setlinebuf(), setbuf().
2018-11-11 10:11:09 +01:00
Andreas Kling
7cc4caee4f
Add ispunct() to LibC + some minor cleanups.
2018-11-11 00:44:04 +01:00
Andreas Kling
3b2f172d48
A bunch of compat work (mostly stubs but some real implementations, too.)
...
Another pass at getting bash-1.14.7 to build. Not that many symbols remain.
2018-11-11 00:20:53 +01:00
Andreas Kling
6a0a2c9ab4
Some improvements to signals.
...
- Add sigprocmask() and sigpending().
- Forked children inherit signal dispositions and masks.
- Exec clears signal dispositions and masks.
2018-11-10 23:30:41 +01:00
Andreas Kling
c97a5862ce
Remove MM::allocate_physical_pages() since it wasn't used.
...
Everyone was allocating one page at a time with allocate_physical_page().
2018-11-10 22:14:41 +01:00
Andreas Kling
36b3dc6c32
Add /proc/PID/cwd, a symlink to the process's current directory.
2018-11-10 18:16:21 +01:00
Andreas Kling
a768c2b919
Rename ProcessInspectionScope to ProcessInspectionHandle.
...
It might be useful to pass these things around.
2018-11-10 16:50:42 +01:00
Andreas Kling
2ac5e14c08
Merge VGA into VirtualConsole.
2018-11-10 16:26:18 +01:00
Andreas Kling
c653bb09b3
Don't include empty segments in canonicalized paths.
...
This makes "/foo/" and "/foo" both resolve to "/foo".
2018-11-10 15:46:39 +01:00
Andreas Kling
39d6b96d21
Make chdir("/") work.
...
It surprisingly wasn't possible to resolve the path "/".
2018-11-10 15:40:24 +01:00
Andreas Kling
b8264e7d47
Merge Disk namespace into the IDEDiskDevice class.
2018-11-10 15:15:31 +01:00
Andreas Kling
cba05ce75e
Before sys$write returns, check for pending unmasked signals.
...
If there is one, put the process into a new BlockedSignal state which makes
the next scheduler iteration dispatch the signal.
2018-11-10 02:43:33 +01:00
Andreas Kling
8605711f4b
Make /bin/clear work again.
...
After I made stdio buffered, we were dropping anything unflushed on exit.
Since /bin/clear just prints out some escape sequences without a newline,
the entire buffer was being discarded.
Also add VirtualConsole::clear() that handles clearing of background VC's.
2018-11-10 00:56:10 +01:00
Andreas Kling
3e3de67f02
Use the VGA start address for fast VirtualConsole scrolling.
...
Instead of memcpy'ing the entire screen every time we press enter at the
bottom, use the VGA start address register to make a "view" onto the
underlying memory that moves downward as we scroll.
Eventually we run out of memory and have to reset to the start of the
buffer. That's when we memcpy everything. It would be cool if there was
some way to get the hardware to act like a ring buffer with automatic
wrapping here but I don't know how to do that.
2018-11-09 21:18:03 +01:00
Andreas Kling
8a865c11ec
Pre-size the ksyms vector for speedier loading.
...
Also show loading progress on the screen because it looks neat.
2018-11-09 20:40:39 +01:00
Andreas Kling
de38e63d3e
Run QEMU with the possibility to attach gdb.
2018-11-09 18:35:32 +01:00
Andreas Kling
985074c790
Okay, now *actually* plug the leaks in exec().
...
I didn't even put the { } properly around everything that would leak.
Let's make sure this works correctly by splitting out the work into a
helper called do_exec().
2018-11-09 18:00:50 +01:00
Andreas Kling
e0ca6bb97e
Add /proc/vnodes, listing basic info about all open vnodes.
2018-11-09 17:46:55 +01:00
Andreas Kling
4914f3b837
Build LibC and Userland with clang as well.
2018-11-09 14:29:00 +01:00
Andreas Kling
ebf308d413
Make kernel build with clang.
...
It's a bit faster than g++ and seems to generate perfectly fine code.
The kernel is also roughly 10% smaller(!)
2018-11-09 12:22:31 +01:00
Andreas Kling
7b3b5f745f
Move <utsname.h> to <sys/utsname.h> for correctness.
2018-11-09 10:24:41 +01:00
Andreas Kling
8249c086c3
Get rid of redundant sys$spawn now that we have fork+exec.
2018-11-09 10:22:27 +01:00
Andreas Kling
3e0a0dd7ed
Fix all current build warnings in the userland.
2018-11-09 10:19:33 +01:00
Andreas Kling
e9cdb6bb9b
Fix all current build warnings in LibC.
2018-11-09 10:09:46 +01:00
Andreas Kling
47b7eeda44
Fix all current build warnings in the kernel.
2018-11-09 10:03:21 +01:00
Andreas Kling
e71cb1c56b
Fix some paging related bugs exposed by the spawn stress test.
...
- Process::exec() needs to restore the original paging scope when called
on a non-current process.
- Add missing InterruptDisabler guards around g_processes access.
- Only flush the TLB when modifying the active page tables.
2018-11-09 01:25:31 +01:00
Andreas Kling
7b96218389
Fix VMO leak in Process::exec().
...
Gotta make sure things get cleaned up before we yield-teleport in exec().
Also VMOs and regions are now viewable through /proc/mm and /proc/regions.
2018-11-08 22:25:29 +01:00
Andreas Kling
cd1e7419f0
Teach Process::exec() about the magic of file-backed VMO's.
...
This is really sweet! :^) The four instances of /bin/sh spawned at
startup now share their read-only text pages.
There are problems and limitations here, and plenty of room for
improvement. But it kinda works.
2018-11-08 21:20:09 +01:00
Andreas Kling
992769c9d4
Make Process::for_each...() functions inline and allocation-free.
...
AK::Function is very handy, but costs us an 8-byte allocation.
Let's not have kmalloc() calls in the scheduler hot path.
2018-11-08 16:09:05 +01:00
Andreas Kling
abdf24cb73
Fix deadlock in synthfs read implementation.
...
Not cool disabling interrupts and then calling out to arbitrary code.
2018-11-08 16:07:45 +01:00
Andreas Kling
3b2dcd5929
Add a VMO pointer to VNode.
...
This way, if anyone tries to map an already mapped file, we share the VMO.
2018-11-08 15:39:26 +01:00
Andreas Kling
862f108cb5
Refactor the virtual memory object model a bit:
...
Process now has a number of Regions.
Each Region is backed by a VMObject.
A VMObject can be file-backed or anonymous. These can be shared.
2018-11-08 14:42:16 +01:00
Andreas Kling
3c8064a787
Support basic mmap'ing of a file!
...
All right, we can now mmap() a file and it gets magically paged in from fs
in response to an NP page fault. This is really cool :^)
I need to refactor this to support sharing of read-only file-backed pages,
but it's cool to just have something working.
2018-11-08 12:59:16 +01:00
Andreas Kling
fdbd9f1e27
Start working on memory-mapped files.
...
First of all, change sys$mmap to take a struct SC_mmap_params since our
sycsall calling convention can't handle more than 3 arguments.
This exposed a bug in Syscall::invoke() needing to use clobber lists.
It was a bit confusing to debug. :^)
2018-11-08 11:40:58 +01:00
Andreas Kling
41a751c90c
Minor tweak to /bin/kill.
2018-11-08 02:07:08 +01:00
Andreas Kling
71a2942a0a
Make it run in QEMU.
...
Looks like the problem was the weirdly-sized floppy image file.
I guess QEMU was inferring the floppy disk geometry from the image size.
2018-11-08 02:03:19 +01:00
Andreas Kling
da3857b0c2
Add some simple write buffering to LibC's stdio.
...
Plumb it all the way to the VirtualConsole. Also fix /bin/cat to write()
the whole chunks we get from read() directly to stdout.
2018-11-08 01:23:47 +01:00
Andreas Kling
e287f8ef3a
The colonel task already had a halt loop.
...
Also don't reap() current in the scheduler, just wait until it's not current.
2018-11-08 00:30:35 +01:00
Andreas Kling
ac1d12465f
Move timer tick handling into Scheduler.
2018-11-08 00:26:04 +01:00
Andreas Kling
27fded7002
Unbreak signal delivery to userspace again.
...
My my, this code is quite fickle.
2018-11-08 00:08:50 +01:00
Andreas Kling
1dbc340da8
Get rid of the undertaker and have waitpid() be the reaper.
...
For dead orphans, the scheduler calls reap().
2018-11-07 23:59:49 +01:00
Andreas Kling
f792349853
Unbreak sys$sigreturn() after colonel process changes.
2018-11-07 23:21:32 +01:00