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. Our current TLB size is 8k. Times 256 contexts is 2MB. Which might just be within the range of possibility. Certainly not if we expand the size of the individual TLBs. Although interestingly, for Alpha we don't need 256 * NB_MMU_MODES, because MMU_KERNEL_IDX always uses context 0, the "global context". I don't recall enough about the intimate details of other TLB hardware to know if there are similar savings that can be had elsewhere. But the amount of memory involved is large enough to suggest that some sort of target-specific sizing of the number of contexts might be required. r~