Andreas Kling
20fb1fc377
Fix some bugs in execve() and make sh use it for process launching.
...
Interrupting children of sh now always works with ^C :^)
2018-11-03 02:08:06 +01:00
Andreas Kling
202bdb553c
Implemented sys$execve().
...
It's really crufty, but it basically works!
2018-11-03 01:51:42 +01:00
Andreas Kling
8accc92c3c
Implement fork()!
...
This is quite cool! The syscall entry point plumbs the register dump
down to sys$fork(), which uses it to set up the child process's TSS
in order to resume execution right after the int 0x80 fork() call. :^)
This works pretty well, although there is some problem with the kernel
alias mappings used to clone the parent process's regions. If I disable
the MM::release_page_directory() code, there's no problem. Probably there's
a premature freeing of a physical page somehow.
2018-11-02 20:41:58 +01:00
Andreas Kling
10b666f69a
Basic ^C interrupt implementation.
...
For testing, I made cat put itself into a new process group.
This should eventually be done by sh between fork() and exec().
2018-11-02 14:06:48 +01:00
Andreas Kling
621217ffeb
Add tcsetpgrp()+tcgetpgrp().
...
One more step on the path to being able to ^C a runaway process. :^)
2018-11-02 13:14:25 +01:00
Andreas Kling
d8f0dd6f3b
Start working on sessions and process groups.
2018-11-02 12:56:51 +01:00
Andreas Kling
90ddbca127
Free physical pages allocated for a process's page directory on exit.
...
Also use a ProcessPagingScope instead of region aliasing to implement
create-process ELF loading.
2018-11-01 23:08:10 +01:00
Andreas Kling
c70afd045e
Use a freelist for GDT entries.
...
Tweak the kmalloc space layout a bit. Get the spawn stress test up
and running again.
2018-11-01 16:23:12 +01:00
Andreas Kling
3a901ae36d
Way tighter locking in process creation.
...
We no longer disable interrupts around the whole affair.
Since MM manages per-process data structures, this works quite smoothly now.
Only procfs had to be tweaked with an InterruptDisabler.
2018-11-01 14:41:49 +01:00
Andreas Kling
52607aa086
Allow processes to go into a BeingInspected state (used by procfs.)
...
This ensures that the process won't get scheduled, and so inspecting
it is safe and easy without blocking interrupts.
2018-11-01 14:21:02 +01:00
Andreas Kling
fd03776443
Add a /proc/PID/fds text files that lists all the fds open in a process.
2018-11-01 14:00:28 +01:00
Andreas Kling
065f0aee35
Preallocate the maximum number of FileHandle pointers (fds) in every process.
...
This could even use a more specific data structure since it doesn't need the
grow/shrink capabilities of a vector.
2018-11-01 13:39:28 +01:00
Andreas Kling
fce81d376c
Move Region and Subregion out of Process and make them free classes.
2018-11-01 13:21:02 +01:00
Andreas Kling
3e532ac7b6
Process now maps regions immediately when they are allocated.
...
This avoids having to do a separate MM.mapRegionsForTask() pass.
Also, more Task => Process renaming that I apparently hadn't saved yet.
2018-11-01 13:15:46 +01:00
Andreas Kling
4e60551aec
Rename Task to Process.
2018-11-01 13:10:12 +01:00