On 08/11/2016 08:24 AM, Alex Bennée wrote:
> +    for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) {
>  
> -        tlb_debug("%d\n", mmu_idx);
> +        if (test_bit(mmu_idx, &mmu_idx_bitmask)) {
> +            tlb_debug("%d\n", mmu_idx);
>  
> -        memset(env->tlb_table[mmu_idx], -1, sizeof(env->tlb_table[0]));
> -        memset(env->tlb_v_table[mmu_idx], -1, sizeof(env->tlb_v_table[0]));
> +            memset(env->tlb_table[mmu_idx], -1, sizeof(env->tlb_table[0]));
> +            memset(env->tlb_v_table[mmu_idx], -1, 
> sizeof(env->tlb_v_table[0]));
> +        }

Maybe better with a

  for (; bitmask; bitmask &= bitmask - 1) {
      int mmu_idx = ctz32(bitmask);

sort of loop?  That would certainly help if bitmasks of less than all-modes is
at all common.

If an all-modes bitmask is common, perhaps we should special case that with a
single much larger memset.


r~

Reply via email to