Exemplo n.º 1
0
CPUXtensaState *cpu_xtensa_init(const char *cpu_model)
{
    static int tcg_inited;
    CPUXtensaState *env;
    const XtensaConfig *config = NULL;
    int i;

    for (i = 0; i < ARRAY_SIZE(core_config); ++i)
        if (strcmp(core_config[i].name, cpu_model) == 0) {
            config = core_config + i;
            break;
        }

    if (config == NULL) {
        return NULL;
    }

    env = g_malloc0(sizeof(*env));
    env->config = config;
    cpu_exec_init(env);

    if (!tcg_inited) {
        tcg_inited = 1;
        xtensa_translate_init();
    }

    xtensa_irq_init(env);
    qemu_init_vcpu(env);
    return env;
}
Exemplo n.º 2
0
XtensaCPU *cpu_xtensa_init(const char *cpu_model)
{
    XtensaCPU *cpu;
    CPUXtensaState *env;
    const XtensaConfig *config = NULL;
    XtensaConfigList *core = xtensa_cores;

    for (; core; core = core->next)
        if (strcmp(core->config->name, cpu_model) == 0) {
            config = core->config;
            break;
        }

    if (config == NULL) {
        return NULL;
    }

    cpu = XTENSA_CPU(object_new(TYPE_XTENSA_CPU));
    env = &cpu->env;
    env->config = config;

    xtensa_irq_init(env);

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

    return cpu;
}
Exemplo n.º 3
0
static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp)
{
    CPUState *cs = CPU(dev);
    XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev);
    Error *local_err = NULL;

#ifndef CONFIG_USER_ONLY
    xtensa_irq_init(&XTENSA_CPU(dev)->env);
#endif

    cpu_exec_realizefn(cs, &local_err);
    if (local_err != NULL) {
        error_propagate(errp, local_err);
        return;
    }

    cs->gdb_num_regs = xcc->config->gdb_regmap.num_regs;

    qemu_init_vcpu(cs);

    xcc->parent_realize(dev, errp);
}
Exemplo n.º 4
0
CPUXtensaState *cpu_xtensa_init(const char *cpu_model)
{
    static int tcg_inited;
    static int debug_handler_inited;
    XtensaCPU *cpu;
    CPUXtensaState *env;
    const XtensaConfig *config = NULL;
    XtensaConfigList *core = xtensa_cores;

    for (; core; core = core->next)
        if (strcmp(core->config->name, cpu_model) == 0) {
            config = core->config;
            break;
        }

    if (config == NULL) {
        return NULL;
    }

    cpu = XTENSA_CPU(object_new(TYPE_XTENSA_CPU));
    env = &cpu->env;
    env->config = config;

    if (!tcg_inited) {
        tcg_inited = 1;
        xtensa_translate_init();
    }

    if (!debug_handler_inited && tcg_enabled()) {
        debug_handler_inited = 1;
        prev_debug_excp_handler =
            cpu_set_debug_excp_handler(breakpoint_handler);
    }

    xtensa_irq_init(env);
    qemu_init_vcpu(env);
    return env;
}