Revision 6ae064fc target-cris/translate.c

b/target-cris/translate.c
3513 3513

  
3514 3514
}
3515 3515

  
3516
struct
3517
{
3518
    uint32_t vr;
3519
    const char *name;
3520
} cris_cores[] = {
3521
    {8, "crisv8"},
3522
    {9, "crisv9"},
3523
    {10, "crisv10"},
3524
    {11, "crisv11"},
3525
    {32, "crisv32"},
3526
};
3527

  
3528
void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf)
3529
{
3530
    unsigned int i;
3531

  
3532
    (*cpu_fprintf)(f, "Available CPUs:\n");
3533
    for (i = 0; i < ARRAY_SIZE(cris_cores); i++) {
3534
        (*cpu_fprintf)(f, "  %s\n", cris_cores[i].name);
3535
    }
3536
}
3537

  
3538
static uint32_t vr_by_name(const char *name)
3539
{
3540
    unsigned int i;
3541
    for (i = 0; i < ARRAY_SIZE(cris_cores); i++) {
3542
        if (strcmp(name, cris_cores[i].name) == 0) {
3543
            return cris_cores[i].vr;
3544
        }
3545
    }
3546
    return 32;
3547
}
3548

  
3549
CRISCPU *cpu_cris_init(const char *cpu_model)
3550
{
3551
    CRISCPU *cpu;
3552
    CPUCRISState *env;
3553

  
3554
    cpu = CRIS_CPU(object_new(TYPE_CRIS_CPU));
3555
    env = &cpu->env;
3556

  
3557
    env->pregs[PR_VR] = vr_by_name(cpu_model);
3558

  
3559
    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
3560

  
3561
    return cpu;
3562
}
3563

  
3564 3516
void cris_initialize_tcg(void)
3565 3517
{
3566 3518
    int i;

Also available in: Unified diff