qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Question about (next_tb & 3) == 2


From: Lyu Mitnick
Subject: [Qemu-devel] Question about (next_tb & 3) == 2
Date: Sat, 27 Aug 2011 02:54:30 +0800

Hello all,

I am a newbie of QEMU and wondering to know  the meaning of:

if ((next_tb & 3) == 2) {
    /* Instruction counter expired.  */
    int insns_left;
    tb = (TranslationBlock *)(long)(next_tb & ~3);
    /* Restore PC.  */
    cpu_pc_from_tb(env, tb);
    insns_left = env->icount_decr.u32;
    if (env->icount_extra && insns_left >= 0) {
        /* Refill decrementer and continue execution.  */
        env->icount_extra += insns_left;
        if (env->icount_extra > 0xffff) {
            insns_left = 0xffff;
        } else {
            insns_left = env->icount_extra;
        }
        env->icount_extra -= insns_left;
        env->icount_decr.u16.low = insns_left;
    } else {
        if (insns_left > 0) {
            /* Execute remaining instructions.  */
            cpu_exec_nocache(insns_left, tb);
        }
        env->exception_index = EXCP_INTERRUPT;
        next_tb = 0;
        cpu_loop_exit();
    }
}

in cpu-exec.c:cpu_exec().

There are two mode of QEMU: without io-thread and with io-thread. Which mode
and what condition cause execution of the code list above??

Thanks a lot

Mitnick


reply via email to

[Prev in Thread] Current Thread [Next in Thread]