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.
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.
This turned out way better than the old code. ELF loading is now quite
straightforward, and we don't need the weird concept of subregions anymore.
Next step is to respect the is_writable flag.
We don't do anything useful with the data yet, but I'm gonna rewrite
the layout code to run off of the program header table instead.
This will allow us to map .text and .rodata sections in read-only memory.
The SpinLock was all backwards and didn't actually work. Fixing it exposed
how wrong most of the locking here is.
I need to come up with a better granularity here.
This took me a couple hours. :^)
The ELF loading code now allocates a single region for the entire
file and creates virtual memory mappings for the sections as needed.
Very nice!
We load /_hello.o which just prints out a simple message.
It executes inside the kernel itself, so no fancy userspace process
or anything, but this is still so cool!