qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Confusion regarding temporaries with branch conditional


From: Alex Bennée
Subject: Re: [Qemu-devel] Confusion regarding temporaries with branch conditional
Date: Wed, 30 Nov 2016 16:55:47 +0000
User-agent: mu4e 0.9.17; emacs 25.1.50.21

Nikunj A Dadhania <address@hidden> writes:

> Hi,
>
> I was writing one instruction and hit following issue:
>
> [snip]/qemu/tcg/tcg.c:2039: tcg fatal error
> qemu-ppc64le: [snip]/qemu/translate-all.c:175: tb_lock: Assertion 
> `!have_tb_lock' failed.
> Segmentation fault (core dumped)

This is confusing because something is trying to take the tb_lock while
you are in code generation. tb_lock is held for code generation to
ensure serialisation of generation.

>
> Debugging deeper found that its something to do with the variable type:
>
>     TCGv nb = tcg_temp_new();
>     tcg_gen_andi_tl(nb, cpu_gpr[rB(ctx->opcode)], 0xFF);
>     tcg_gen_brcondi_tl(TCG_COND_EQ, nb, 0, l1);
>     [ Do something here]
>     gen_set_label(l1);
>     tcg_temp_free(nb);
>
> If I change the variable as "local temporary", the code works fine:
>
>     TCGv nb = tcg_temp_local_new();
>     tcg_gen_andi_tl(nb, cpu_gpr[rB(ctx->opcode)], 0xFF);
>     tcg_gen_brcondi_tl(TCG_COND_EQ, nb, 0, l1);
>     [ Do something here]
>     gen_set_label(l1);
>     tcg_temp_free(nb);
>
> I see lot of code that is using temporaries for similar operations,
> example target-ppc/translate.c:gen_check_align(). How is that working,
> is this a bug there as well?

Well that is odd. Are you sure there is no side effect that is
attempting to modify run state during generation? I'm thinking of
changing memory maps or other such stuff. A back trace at the assert
would make things clearer.

>
> Regards,
> Nikunj


--
Alex Bennée



reply via email to

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