3 ms·
I ported V6 back in the day, I continually would come back to this comment from different code path, always mystified, one day I came to it and it was obvious .
by Taniwha 10y ago
I ported V6 back in the day, I continually would come back to this comment from different code path, always mystified, one day I came to it and it was obvious ....
Essentially this was the days before save/restore were in the C library - savu/aretu are an equivalent that works differently (you savu() somewhere and aretu() somewhere else, it was sad because aretu() played stack games so unlike save() savu() didn't just return a different value on return)
Essentially v6 was a swapping system, fork() (or newproc() in the kernel) worked by allocating memory and making a copy of an app in memory, if there wasn't enough memory it would pretend to swap out the existing process, then mark it as the new process and set a flag (SSWAP), this is the case when it's returning - a process is being swapped in, part way through it realises it's really this special case and this code returns into newproc() as the new process