qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] TCG is hard to understand!


From: Jun Koi
Subject: Re: [Qemu-devel] TCG is hard to understand!
Date: Fri, 11 Dec 2009 12:18:37 +0900

Hi Alex,

>> However, I still dont understand what the line (3) does. Could you
>> give some hints?
>>
>>>> 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
>
> This sets the position counter to the current address. That's important in 
> case a helper command calls an exception, because only then the unrolling 
> works and the IP is actually at the instruction we're processing.

This is excellent, thanks!

Another question: I look at tcg_gen_callN() to see how the helper is
executed. We put the helper opcode into the TCG code buffer, and put
helper's params into gen_opparam_buf.

However, then when TCG generates code to actually call the helper, we
just put the opcode of the host insn into the output buffer, which is
target code at this step, then run it.

Now when the helper is executed, it must get its param from the stack,
which is really the host stack. But as said above, its params are in
gen_opparam_buf, but not in stack?
I searched around, and dont see anywhere we link gen_opparam_buf with
the host stack. So how the helper can get its param??

Surely I missed something, or misunderstand the whole picture. Any hint?

Thanks a lot,
Jun




reply via email to

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