问题
I am working on an application which requires me to make some changes with the part of the QEMU source code which deals with RDTSC calls. However, I am not able to locate the same in the huge source code.
回答1:
Key portion is here:
target-i386/translate.c
6850 case 0x131: /* rdtsc */
6851 if (s->cc_op != CC_OP_DYNAMIC)
6852 gen_op_set_cc_op(s->cc_op);
6853 gen_jmp_im(pc_start - s->cs_base);
6854 if (use_icount)
6855 gen_io_start();
6856 gen_helper_rdtsc();
6857 if (use_icount) {
6858 gen_io_end();
6859 gen_jmp(s, s->pc - s->cs_base);
6860 }
6861 break;
For general understanding of qemu code related to code translation, this answer is good:
Qemu code translation main execution loop
来源:https://stackoverflow.com/questions/21062308/where-is-the-code-for-rdtsc-handler-in-qemu-source-code