Skip to contentSkip to conversation

Translated Basic Block Instrumentation

Qemu-devel Jiaqing Du 1 participant 1 message Oct 7, 2009

lore
Share & tools
lore

Jiaqing Du

author
#0 lore raw

Hi list,

I'm working on the instrumentation of each (translated) basic block. The host arch is x86_64. At the beginning of each translated basic block, I added some instructions to do some accounting. Then under some conditions I need to raise an NMI inside a translated basic block. The following is (part of ) what I added to tcg_gen_code_common().

    /* movq EXCP02_NMI,%rdi */
    tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_RDI, EXCP02_NMI);

    /* callq helper_raise_interrupt(EXCP02_NMI) */
    tcg_out8(s, 0xe8);
    tcg_out32(s, (tcg_target_long)raise_exception -

(tcg_target_long)s->code_ptr - 4);

It seems that this NMI is not handled properly in cpu_exec(). I also tried cpu_interrupt(), this also did not work. What I want to do is to raise an NMI inside a translated basic block, any suggestions?

Thanks,
Jiaqing