Port-mips archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CURLWP global register in NetBSD/mips



On Dec 21, 2010, at 1:56 AM, Toru Nishimura wrote:

> Guys,
> 
> NetBSD/mips kernel uses a dedicated register to hold curlwp
> global variable.  Register S7 is used in -current whileT8 in
> matt-nb5-mips64 branch (why differ?)

Better code.  T8 is rarely used but S7 is one of the saved
registers and used much more often.

> The place where curlwp register is reassigned is pretty
> limited.  As far as I understand, only cpu_switchto() does it.
> 
> Looking at cpu_lwp_fork() bottom half, we find a sequence
> to assign values for newlwp's switchframe.  The following line
> 
> pcb->pcb_context.val[MIPS_CURLWP_LABEL] = (intptr_t)l2;
> 
> is supposed to make the dedicated curlwp register to hold
> newlwp at the very bottom of cpu_switchto().
> 
> During the context switch steps, cpu_switchto() assigns newlwp
> value to the reserved register anyway.  So, this particular
> switchframe arrangement for cpu_switchto() bottom makes little
> sense.
> 
> Now I propose here;
> 
> 1. remove [... _CURLWP_LABEL] arrangement in vm_machdep.c
> 2. remove S7 (T8) value restoration at the bottom of cpu_switchto().
> 
> Comments are welcome.

3. Remove S7 (T8) value saving as well.  


Home | Main Index | Thread Index | Old Index