On Sat, Jun 09, 2012 at 05:44:55AM -0400, Xin Tong wrote: > In QEMU x86, TB translation flags are set up when the TB is allocated. > what will happen if the translation flags are modified by one > instruction in the translation block ? will the translation block be > terminated right there.
Can you give an example on an instruction in the tb modifying the translation flags? > For example, there is a code32 flag which is set to the value of > (flags >> HF_CS32_SHIFT) &1. The flags is initialized when the TB is > allocated. what if it is modified by one instruction in the > translation block when the translated code is run. At translation > time, there may not be a way to detect this. Take a look on tb_find_fast/tb_find_slow (cpu-exec.c), you'll see something like, --- cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); if (unlikely(!tb || tb->pc != pc || tb->cs_base != cs_base || tb->flags != flags)) { tb = tb_find_slow(env, pc, cs_base, flags); } --- If current flags (flags) is not match the flags while translating the tb (tb->flags), then the translated tb will be discarded. Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj