[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] TCG is hard to understand!
From: |
Jun Koi |
Subject: |
[Qemu-devel] TCG is hard to understand! |
Date: |
Fri, 11 Dec 2009 01:44:52 +0900 |
Hi,
I am trying to understand how TCG works. For example, I look at the
LLDT insn on x86.
In target-i386/translate.c, we translate LLDT to TCG code, like below:
static TCGv_i32 cpu_tmp2_i32; // 1
...
gen_ldst_modrm(s, modrm, OT_WORD, OR_TMP0, 0); // 2
gen_jmp_im(pc_start - s->cs_base); // 3
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); // 4
gen_helper_lldt(cpu_tmp2_i32); // 5
This is quite confused. I understand that:
- In line (2), we retrieve the operand and save it into cpu_T[0].
- Line (3) generates jump code, but I dont understand why we need that ????
- Line (4) generate the code to copy cpu_T[0] to the (local) variable
cpu_tmp2_i32.
However, as tcg_gen_trunc_tl_i32() put the *value* of that variable,
but not its *address*, into the generated code, I dont see how next
line (5) can generate code that use the same variable.
Clearly there is no connection between cpu_tmp2_i32 on line (4) and
line (5), so how the generated code works here??
Thanks a lot,
Jun
- [Qemu-devel] TCG is hard to understand!,
Jun Koi <=