qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Weird behavior while using the instruction counter


From: Luis Pureza
Subject: Re: [Qemu-devel] Weird behavior while using the instruction counter
Date: Thu, 24 Jul 2008 16:17:14 +0100

On Thu, Jul 24, 2008 at 3:56 PM, Paul Brook <address@hidden> wrote:
>> > >cpu_io_recompile (and possibly other
>> > > places) assume the currently executing TB is the only tb that matches.
>> > > It needs to invalidate the original TB (if it exists) as well as the
>> > > uncached one.
>>
>> What about this then:
>>
>> tb2 = env->tb_jmp_cache[tb_jmp_cache_hash_func(tb->pc)];
>> if (tb2) {
>>     tb_phys_invalidate(tb2, -1);
>> }
>
> I don't think this is correct. If we have chained TBs then the jump cache
> entry may have been overwritten by a different TB.
> It's also inefficient. If we didn't get here via cpu_exec_nocache then we can
> invalidate a TB unnecessarily.
>
> Anywhere that uses tb_find_pc/cpu_restore_state is probably broken and will
> need auditing for the problems I mentioned above.

Ok. In the meanwhile, I'll stick with

tb2 = env->tb_jmp_cache[tb_jmp_cache_hash_func(tb->pc)];
    if (tb2 && tb2 != tb && tb2->pc == tb->pc && tb2->cs_base == tb->cs_base
    && tb2->flags == tb->flags) {
    tb_phys_invalidate(tb2, -1);
}

Unless, of course, you tell me there's something horribly wrong with this :-)
Thank you,

Luis Pureza




reply via email to

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