Revision 29929e34 target-mips/translate_init.c

b/target-mips/translate_init.c
148 148
        .Status_rw_bitmask = 0x3678FFFF,
149 149
        .CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) |
150 150
                    (1 << FCR0_D) | (1 << FCR0_S) |
151
                    (0x4 << FCR0_PRID) | (0x0 << FCR0_REV),
151
                    (0x5 << FCR0_PRID) | (0x0 << FCR0_REV),
152 152
    },
153 153
#endif
154 154
};
......
180 180
    }
181 181
}
182 182

  
183
#ifndef CONFIG_USER_ONLY
184
static void no_mmu_init (CPUMIPSState *env, mips_def_t *def)
185
{
186
    env->nb_tlb = 1;
187
    env->map_address = &no_mmu_map_address;
188
}
189

  
190
static void fixed_mmu_init (CPUMIPSState *env, mips_def_t *def)
191
{
192
    env->nb_tlb = 1;
193
    env->map_address = &fixed_mmu_map_address;
194
}
195

  
196
static void r4k_mmu_init (CPUMIPSState *env, mips_def_t *def)
197
{
198
    env->nb_tlb = 1 + ((def->CP0_Config1 >> CP0C1_MMU) & 63);
199
    env->map_address = &r4k_map_address;
200
    env->do_tlbwi = r4k_do_tlbwi;
201
    env->do_tlbwr = r4k_do_tlbwr;
202
    env->do_tlbp = r4k_do_tlbp;
203
    env->do_tlbr = r4k_do_tlbr;
204
}
205
#endif /* CONFIG_USER_ONLY */
206

  
183 207
int cpu_mips_register (CPUMIPSState *env, mips_def_t *def)
184 208
{
185 209
    if (!def)
......
199 223
    env->CCRes = def->CCRes;
200 224
    env->Status_rw_bitmask = def->Status_rw_bitmask;
201 225
    env->fcr0 = def->CP1_fcr0;
202
#if defined (MIPS_USES_R4K_TLB)
203
    env->nb_tlb = 1 + ((def->CP0_Config1 >> CP0C1_MMU) & 63);
226
#ifndef CONFIG_USER_ONLY
227
    switch ((env->CP0_Config0 >> CP0C0_MT) & 3) {
228
        case 0:
229
            no_mmu_init(env, def);
230
            break;
231
        case 1:
232
            r4k_mmu_init(env, def);
233
            break;
234
        case 3:
235
            fixed_mmu_init(env, def);
236
            break;
237
        default:
238
            /* Older CPUs like the R3000 may need nonstandard handling here. */
239
            cpu_abort(env, "MMU type not supported\n");
240
    }
204 241
    env->CP0_Random = env->nb_tlb - 1;
205 242
    env->tlb_in_use = env->nb_tlb;
206
#endif
243
#endif /* CONFIG_USER_ONLY */
207 244
    return 0;
208 245
}

Also available in: Unified diff