Esempio n. 1
0
LM32CPU *cpu_lm32_init(const char *cpu_model)
{
    LM32CPU *cpu;
    CPULM32State *env;
    const LM32Def *def;
    static int tcg_initialized;

    def = cpu_lm32_find_by_name(cpu_model);
    if (!def) {
        return NULL;
    }

    cpu = LM32_CPU(object_new(TYPE_LM32_CPU));
    env = &cpu->env;

    env->features = def->features;
    env->num_bps = def->num_breakpoints;
    env->num_wps = def->num_watchpoints;
    env->cfg = cfg_by_def(def);

    qemu_init_vcpu(env);

    if (tcg_enabled() && !tcg_initialized) {
        tcg_initialized = 1;
        lm32_translate_init();
    }

    return cpu;
}
Esempio n. 2
0
CPUState *cpu_lm32_init(const char *cpu_model)
{
    CPUState *env;
    const LM32Def *def;
    static int tcg_initialized;

    def = cpu_lm32_find_by_name(cpu_model);
    if (!def) {
        return NULL;
    }

    env = qemu_mallocz(sizeof(CPUState));

    env->features = def->features;
    env->num_bps = def->num_breakpoints;
    env->num_wps = def->num_watchpoints;
    env->cfg = cfg_by_def(def);
    env->flags = 0;

    cpu_exec_init(env);
    cpu_reset(env);

    if (!tcg_initialized) {
        tcg_initialized = 1;
        lm32_translate_init();
    }

    return env;
}
Esempio n. 3
0
static void lm32_cpu_initfn(Object *obj)
{
    CPUState *cs = CPU(obj);
    LM32CPU *cpu = LM32_CPU(obj);
    CPULM32State *env = &cpu->env;
    static bool tcg_initialized;

    cs->env_ptr = env;
    cpu_exec_init(env);

    env->flags = 0;

    if (tcg_enabled() && !tcg_initialized) {
        tcg_initialized = true;
        lm32_translate_init();
    }
}