当前位置: 首页>>代码示例>>C++>>正文


C++ CPUClass类代码示例

本文整理汇总了C++中CPUClass的典型用法代码示例。如果您正苦于以下问题:C++ CPUClass类的具体用法?C++ CPUClass怎么用?C++ CPUClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CPUClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cpu_get_memory_mapping

void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
                            Error **errp)
{
    CPUClass *cc = CPU_GET_CLASS(cpu);

    return cc->get_memory_mapping(cpu, list, errp);
}
开发者ID:B-Rich,项目名称:qemu,代码行数:7,代码来源:cpu.c

示例2: generic_loader_reset

static void generic_loader_reset(void *opaque)
{
    GenericLoaderState *s = GENERIC_LOADER(opaque);

    if (s->set_pc) {
        CPUClass *cc = CPU_GET_CLASS(s->cpu);
        cpu_reset(s->cpu);
        if (cc) {
            cc->set_pc(s->cpu, s->addr);
        }
    }

    if (s->data_len) {
        MemTxAttrs attrs = { .unspecified = 0,
                             .secure = 0,
                             .user = 0,
                             .debug = 0,
                             .requester_id = 0,
        };

        attrs.debug = s->attrs.debug;
        attrs.secure = s->attrs.secure;
        attrs.requester_id = s->attrs.requester_id;

        assert(s->data_len < sizeof(s->data));
        address_space_rw(s->cpu->as, s->addr, attrs, (uint8_t *)&s->data,
                         s->data_len, true);
    }
}
开发者ID:Xilinx,项目名称:qemu,代码行数:29,代码来源:generic-loader.c

示例3: arm_v7m_cpu_exec_interrupt

static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
{
    CPUClass *cc = CPU_GET_CLASS(cs);
    ARMCPU *cpu = ARM_CPU(cs);
    CPUARMState *env = &cpu->env;
    bool ret = false;


    if (interrupt_request & CPU_INTERRUPT_FIQ
        && !(env->daif & PSTATE_F)) {
        cs->exception_index = EXCP_FIQ;
        cc->do_interrupt(cs);
        ret = true;
    }
    /* ARMv7-M interrupt return works by loading a magic value
     * into the PC.  On real hardware the load causes the
     * return to occur.  The qemu implementation performs the
     * jump normally, then does the exception return when the
     * CPU tries to execute code at the magic address.
     * This will cause the magic PC value to be pushed to
     * the stack if an interrupt occurred at the wrong time.
     * We avoid this by disabling interrupts when
     * pc contains a magic address.
     */
    if (interrupt_request & CPU_INTERRUPT_HARD
        && !(env->daif & PSTATE_I)
        && (env->regs[15] < 0xfffffff0)) {
        cs->exception_index = EXCP_IRQ;
        cc->do_interrupt(cs);
        ret = true;
    }
    return ret;
}
开发者ID:GamerSource,项目名称:qemu,代码行数:33,代码来源:cpu.c

示例4: arm_cpu_exec_interrupt

bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
{
    CPUClass *cc = CPU_GET_CLASS(cs);
    bool ret = false;

    if (interrupt_request & CPU_INTERRUPT_FIQ
        && arm_excp_unmasked(cs, EXCP_FIQ)) {
        cs->exception_index = EXCP_FIQ;
        cc->do_interrupt(cs);
        ret = true;
    }
    if (interrupt_request & CPU_INTERRUPT_HARD
        && arm_excp_unmasked(cs, EXCP_IRQ)) {
        cs->exception_index = EXCP_IRQ;
        cc->do_interrupt(cs);
        ret = true;
    }
    if (interrupt_request & CPU_INTERRUPT_VIRQ
        && arm_excp_unmasked(cs, EXCP_VIRQ)) {
        cs->exception_index = EXCP_VIRQ;
        cc->do_interrupt(cs);
        ret = true;
    }
    if (interrupt_request & CPU_INTERRUPT_VFIQ
        && arm_excp_unmasked(cs, EXCP_VFIQ)) {
        cs->exception_index = EXCP_VFIQ;
        cc->do_interrupt(cs);
        ret = true;
    }

    return ret;
}
开发者ID:iloveican,项目名称:qemu,代码行数:32,代码来源:cpu.c

示例5: cpu_dump_statistics

void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
                         int flags)
{
    CPUClass *cc = CPU_GET_CLASS(cpu);

    if (cc->dump_statistics) {
        cc->dump_statistics(cpu, f, cpu_fprintf, flags);
    }
}
开发者ID:B-Rich,项目名称:qemu,代码行数:9,代码来源:cpu.c

示例6: cpu_exist_cb

static void cpu_exist_cb(CPUState *cpu, void *data)
{
    CPUClass *klass = CPU_GET_CLASS(cpu);
    CPUExistsArgs *arg = data;

    if (klass->get_arch_id(cpu) == arg->id) {
        arg->found = true;
    }
}
开发者ID:01org,项目名称:KVMGT-qemu,代码行数:9,代码来源:cpu.c

示例7: target_memory_rw_debug

static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
        uint8_t *buf, int len, bool is_write)
{
    CPUClass *cc = CPU_GET_CLASS(cpu);

    if (cc->memory_rw_debug) {
        return cc->memory_rw_debug(cpu, addr, buf, len, is_write);
    }
    return cpu_memory_rw_debug(cpu, addr, buf, len, is_write);
}
开发者ID:Blub,项目名称:qemu,代码行数:10,代码来源:gdbstub.c

示例8: cpu_dump_state

void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
                    int flags)
{
    CPUClass *cc = CPU_GET_CLASS(cpu);

    if (cc->dump_state) {
        cpu_synchronize_state(cpu);
        cc->dump_state(cpu, f, cpu_fprintf, flags);
    }
}
开发者ID:B-Rich,项目名称:qemu,代码行数:10,代码来源:cpu.c

示例9: gdb_set_cpu_pc

static void gdb_set_cpu_pc(GDBState *s, target_ulong pc)
{
    CPUState *cpu = s->c_cpu;
    CPUClass *cc = CPU_GET_CLASS(cpu);

    cpu_synchronize_state(cpu);
    if (cc->set_pc) {
        cc->set_pc(cpu, pc);
    }
}
开发者ID:CarterTsai,项目名称:qemu_stm32,代码行数:10,代码来源:gdbstub.c

示例10: arm_cpu_exec_interrupt

bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
{
    CPUClass *cc = CPU_GET_CLASS(cs);
    CPUARMState *env = cs->env_ptr;
    uint32_t cur_el = arm_current_el(env);
    bool secure = arm_is_secure(env);
    uint32_t target_el;
    uint32_t excp_idx;
    bool ret = false;

    if (interrupt_request & CPU_INTERRUPT_FIQ) {
        excp_idx = EXCP_FIQ;
        target_el = arm_phys_excp_target_el(cs, excp_idx, cur_el, secure);
        if (arm_excp_unmasked(cs, excp_idx, target_el)) {
            cs->exception_index = excp_idx;
            env->exception.target_el = target_el;
            cc->do_interrupt(cs);
            ret = true;
        }
    }
    if (interrupt_request & CPU_INTERRUPT_HARD) {
        excp_idx = EXCP_IRQ;
        target_el = arm_phys_excp_target_el(cs, excp_idx, cur_el, secure);
        if (arm_excp_unmasked(cs, excp_idx, target_el)) {
            cs->exception_index = excp_idx;
            env->exception.target_el = target_el;
            cc->do_interrupt(cs);
            ret = true;
        }
    }
    if (interrupt_request & CPU_INTERRUPT_VIRQ) {
        excp_idx = EXCP_VIRQ;
        target_el = 1;
        if (arm_excp_unmasked(cs, excp_idx, target_el)) {
            cs->exception_index = excp_idx;
            env->exception.target_el = target_el;
            cc->do_interrupt(cs);
            ret = true;
        }
    }
    if (interrupt_request & CPU_INTERRUPT_VFIQ) {
        excp_idx = EXCP_VFIQ;
        target_el = 1;
        if (arm_excp_unmasked(cs, excp_idx, target_el)) {
            cs->exception_index = excp_idx;
            env->exception.target_el = target_el;
            cc->do_interrupt(cs);
            ret = true;
        }
    }

    return ret;
}
开发者ID:GamerSource,项目名称:qemu,代码行数:53,代码来源:cpu.c

示例11: cpu_exists

bool cpu_exists(int64_t id)
{
    CPUState *cpu;

    CPU_FOREACH(cpu) {
        CPUClass *cc = CPU_GET_CLASS(cpu);

        if (cc->get_arch_id(cpu) == id) {
            return true;
        }
    }
    return false;
}
开发者ID:32bitmicro,项目名称:riscv-qemu,代码行数:13,代码来源:cpu.c

示例12: CPU_GET_CLASS

static AcpiCpuStatus *get_cpu_status(CPUHotplugState *cpu_st, DeviceState *dev)
{
    CPUClass *k = CPU_GET_CLASS(dev);
    uint64_t cpu_arch_id = k->get_arch_id(CPU(dev));
    int i;

    for (i = 0; i < cpu_st->dev_count; i++) {
        if (cpu_arch_id == cpu_st->devs[i].arch_id) {
            return &cpu_st->devs[i];
        }
    }
    return NULL;
}
开发者ID:cminyard,项目名称:qemu,代码行数:13,代码来源:cpu.c

示例13: gdb_write_register

static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg)
{
    CPUClass *cc = CPU_GET_CLASS(cpu);
    CPUArchState *env = cpu->env_ptr;
    GDBRegisterState *r;

    if (reg < cc->gdb_num_core_regs) {
        return cc->gdb_write_register(cpu, mem_buf, reg);
    }

    for (r = cpu->gdb_regs; r; r = r->next) {
        if (r->base_reg <= reg && reg < r->base_reg + r->num_regs) {
            return r->set_reg(env, mem_buf, reg - r->base_reg);
        }
    }
    return 0;
}
开发者ID:Blub,项目名称:qemu,代码行数:17,代码来源:gdbstub.c

示例14: generic_loader_reset

static void generic_loader_reset(void *opaque)
{
    GenericLoaderState *s = GENERIC_LOADER(opaque);

    if (s->set_pc) {
        CPUClass *cc = CPU_GET_CLASS(s->cpu);
        cpu_reset(s->cpu);
        if (cc) {
            cc->set_pc(s->cpu, s->addr);
        }
    }

    if (s->data_len) {
        assert(s->data_len < sizeof(s->data));
        dma_memory_write(s->cpu->as, s->addr, &s->data, s->data_len);
    }
}
开发者ID:Biamp-Systems,项目名称:mb-qemu,代码行数:17,代码来源:generic-loader.c

示例15: cpu_sparc_register

static int cpu_sparc_register(SPARCCPU *cpu, const char *cpu_model)
{
    CPUClass *cc = CPU_GET_CLASS(cpu);
    CPUSPARCState *env = &cpu->env;
    char *s = g_strdup(cpu_model);
    char *featurestr, *name = strtok(s, ",");
    sparc_def_t def1, *def = &def1;
    Error *err = NULL;

    if (cpu_sparc_find_by_name(def, name) < 0) {
        g_free(s);
        return -1;
    }

    env->def = g_new0(sparc_def_t, 1);
    memcpy(env->def, def, sizeof(*def));

    featurestr = strtok(NULL, ",");
    cc->parse_features(CPU(cpu), featurestr, &err);
    g_free(s);
    if (err) {
        error_report("%s", error_get_pretty(err));
        error_free(err);
        return -1;
    }

    env->version = def->iu_version;
    env->fsr = def->fpu_version;
    env->nwindows = def->nwindows;
#if !defined(TARGET_SPARC64)
    env->mmuregs[0] |= def->mmu_version;
    cpu_sparc_set_id(env, 0);
    env->mxccregs[7] |= def->mxcc_version;
#else
    env->mmu_version = def->mmu_version;
    env->maxtl = def->maxtl;
    env->version |= def->maxtl << 8;
    env->version |= def->nwindows - 1;
#endif
    return 0;
}
开发者ID:AbnerChang,项目名称:RiscVQemuPcat,代码行数:41,代码来源:cpu.c


注:本文中的CPUClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。