qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] icount and tb chaining


From: James Greensky
Subject: Re: [Qemu-devel] icount and tb chaining
Date: Wed, 18 Jan 2012 11:49:52 -0800

On Tue, Jan 17, 2012 at 7:22 PM, 陳韋任 <address@hidden> wrote:
>> previously returned tb. This is usually 0/1. When running icount, you
>> can also get a 2 value in these least significant digits, indicating
>> that the translation block was restarted due to the
>> icount_decr.u16.low field being exhausted but having instructions left
>> to execute in icount_extra. This 2 value falls through to tb_add_jump,
>> which then updates the tb's jmp_first field, as both tb and next_tb
>> refer to the same translation block. My question is why is this
>> necessary, why not do nothing, and leave the previous chaining intact?
>> I hope this is clearer and thanks for the response. -Jim
>
>  I have a question here. Look at gen_icount_start and gen_icount_end in
> gen-icount.h, I think the least significant bits are set to 2 by following
> code.
>
>  tcg_gen_exit_tb((tcg_target_long)tb + 2);
>
> And you said,
>
>  "indicating that the translation block was restarted due to the
>   icount_decr.u16.low field being exhausted but having instructions left
>   to execute in icount_extra."
>
> From the code snipt of gen_icount_start below, I can only figure out something
> (icount_decr.u32?) is exhausted so it will jump to label set by gen_icount_end
> and execute "tcg_gen_exit_tb((tcg_target_long)tb + 2)". I only see 
> icount_extra
> and icount_decr.u16.low are dealt in cpu_exec (cpu-exec.c). Do I miss 
> something
> or misunderstand what you said? Thanks.
>
> ---
>    icount_label = gen_new_label();
>    count = tcg_temp_local_new_i32();
>    tcg_gen_ld_i32(count, cpu_env, offsetof(CPUState, icount_decr.u32));
>    /* This is a horrid hack to allow fixing up the value later.  */
>    icount_arg = gen_opparam_ptr + 1;
>    tcg_gen_subi_i32(count, count, 0xdeadbeef);
>
>    tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, icount_label);
> ---
>
> 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

What i mean here is that in gen-icount.h, the icount_decr.u32 field is
exhausted and jumps out to the cpu-exec loop. This is where you would
fall into tb_add_jump with the second argument being 2, and only if
icount_extra was greater than zero. This is what I meant, and
previously you showed me that the chaining is left intact by the check
in tb_add_jump. Hope this is clearer. -Jim



reply via email to

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