> In any case, that's not the real problem. Linux user threads do not
> have true separate stacks. They share their _entire_ address space;
> the stacks are all bounded (default is 2MB) and grouped together at
> the top of the available memory region.
A comment by Kevin reminded me of the real constraint (which the
experts probably take for granted): this system is supposed to work on
shared-memory multiprocessors and multithreaded CPUs.
In both cases two or more threads within an address space can be
active simultaneously. On a multithreaded CPU (in particular) there's
only one TLB, so memory (including any memory specially handled by the
kernel) is all held in common. The *only* thing available to a user
privilege program which distinguishes the threads is the CPU register
(Well, and the stack, which is a difference inherited from the value
in the stack pointer register. But the stack pointer is not really
going to help much to return a thread-characteristic pointer or ID.)
So MIPS really do need to figure out which register can be freed up.
Well, at least I know why now. Hope the rest of you aren't too bored!