/* This function will transform @tc into a local index within the returned #CPUMIPSState.  */
static CPUMIPSState* mips_cpu_map_tc(CPUMIPSState *env, int *tc)
/* This function will transform @tc into a local index within the returned #CPUMIPSState.  */
static CPUMIPSState* mips_cpu_map_tc(CPUMIPSState *env, int *tc)
{
    MIPSCPU *cpu;
    CPUState *cs;
    CPUState *other_cs;
    int vpe_idx;
    int tc_idx = *tc;
    if (!(env->CP0_VPEConf0 & (1 << CP0VPEC0_MVP))) {
        *tc = env->current_tc;
        return env;
    }
    cs = CPU(mips_env_get_cpu(env));
    vpe_idx = tc_idx / cs->nr_threads;
    *tc = tc_idx % cs->nr_threads;
    other_cs = qemu_get_cpu(vpe_idx);
    if (other_cs == NULL) {
        return env;
    }
    cpu = MIPS_CPU(other_cs);
    return &cpu->env;
}