On 22 January 2014 17:32, Richard Henderson <r...@twiddle.net> wrote: > On 01/22/2014 08:55 AM, Peter Maydell wrote: >> Has anybody ever looked at implementing proper TLB contexts? > > I've thought about it. The best I could come up with is a pointer within ENV > that points to the current TLB context. It definitely adds another load insn > on the fast path, but we should be able to schedule that first, since it > depends on nothing but the mem_index constant. Depending on the schedule, it > may require reserving another register on the fast path, which could be a > problem for i686. > > It would also greatly expand the size of ENV. > > E.g. Alpha would need to implement 256 contexts to match the hardware. We > currently get away with pretending to implement contexts by implementing none > at all, and flushing the TLB at every context change.
I don't really know the details of Alpha, but can you get away with just "we implement N contexts, and only actually keep the most recently used N"? This is effectively what we're doing at the moment, with N==1. (ASIDs on ARM are 16 bit now, so we definitely wouldn't want to keep an entire TLB for each ASID; if we ever implemented virtualization there's another 8 bits of VMID and each VMID has its own ASID range...) thanks -- PMM