Subject: Re: IDT MIPS_RC32364 support
To: None <port-mips@netbsd.org>
From: Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
List: port-mips
Date: 09/12/2000 08:19:56
>> I'd take the path to get rid of abused XContext register.  Explicit
>> usage of 64bit DMTC/DMFC insn and other can be reducted into 32bit
>> counter parts.  I'm uncertain the advantage of "performance and
>> efficiency" of such 64bit insns given 32bit OS nature of NetBSD/mips.
>> Tohru Nishimura
>
> here is a patch that gets rid of the abused XContext usage.
> i tested it on my hpcmips box (vr4121) and it works.   also 
> works on jeffs' RM5231.   i plan on committing it.

	[ ... introducing segbase global variable ... ]

New global variable 'segbase' which holds pmap->p_vmspace->vm_map.pmap
is found useful to R3000 processor too.  pmap_activate() is as simple as;

void    
pmap_activate(p)
        struct proc *p;
{
        pmap_t pmap = p->p_vmspace->vm_map.pmap;
  
        pmap_asid_alloc(pmap);
        if (p == curproc) {
                segbase = pmap->pm_segtab;
                MachSetPID(pmap->pm_asid);
        }
}

and, R3000 UTLBmiss handler can save one 'lw' insn;

VECTOR(mips1_UTLBMiss, unknown)
        .set    noat
        mfc0    k0, MIPS_COP_0_BAD_VADDR        # get the virtual address
        lw      k1, _C_LABEL(segbase)           # get the current segment table
        bltz    k0, 1f                          # R3000 chip bug
        srl     k0, k0, SEGSHIFT                # compute segment table index
        sll     k0, k0, 2
        ...

For long run, the way to hold PTE might be reworked from scratch, then
'segbase' would be a constant value in KSEG2, but the change won't happen
this time.

Tohru Nishimura