From: Richard Henderson <richard.henderson@linaro.org>
To: Luis Fernando Fujita Pires <luis.pires@eldorado.org.br>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>
Cc: "lagarcia@br.ibm.com" <lagarcia@br.ibm.com>,
Bruno Piazera Larsen <bruno.larsen@eldorado.org.br>,
Matheus Kowalczuk Ferst <matheus.ferst@eldorado.org.br>,
"f4bug@amsat.org" <f4bug@amsat.org>,
"david@gibson.dropbear.id.au" <david@gibson.dropbear.id.au>
Subject: Re: [PATCH v2 04/15] target/ppc: Move DISAS_NORETURN setting into gen_exception*
Date: Thu, 29 Apr 2021 10:21:59 -0700 [thread overview]
Message-ID: <92e7200b-a4fd-7595-785d-dbdd24f37414@linaro.org> (raw)
In-Reply-To: <CP2PR80MB3668FC30589403AB99F1F66CDA5F9@CP2PR80MB3668.lamprd80.prod.outlook.com>
On 4/29/21 10:07 AM, Luis Fernando Fujita Pires wrote:
>>> -static inline void gen_stop_exception(DisasContext *ctx)
>>> +static inline void gen_end_tb_exception(DisasContext *ctx, uint32_t
>>> +excp)
>>> {
>>> - gen_update_nip(ctx, ctx->base.pc_next);
>>> - ctx->exception = POWERPC_EXCP_STOP;
>>> + /* No need to update nip for SYNC/BRANCH, as execution flow will change
>> */
>>> + if ((excp != POWERPC_EXCP_SYNC) &&
>>> + (excp != POWERPC_EXCP_BRANCH))
>>> + {
>>> + gen_update_nip(ctx, ctx->base.pc_next);
>>> + }
>>> + ctx->exception = excp;
>>> + ctx->base.is_jmp = DISAS_NORETURN;
>>> }
>>
>> Hmm. You didn't actually raise the exception, so you can't set
>> DISAS_NORETURN that way. It looks like you should be using
>> gen_exception_nip().
>
> This is reproducing the behavior that was implemented before the DISAS_NORETURN changes, that caused check-tcg to fail with an assertion otherwise.
>
> IIUC, POWERPC_EXCP_{STOP,SYNC,BRANCH} are not really exceptions and, in these cases, ctx->exception is being used just to cause ppc_tr_translate_insn() to end the translation block. If so, we should not be using ctx->exception for that, but I believe fixing that to not use ctx->exception belongs in a separate stand-alone patch.
Hum. Well, you can set is_jmp = DISAS_TOO_MANY to force exit from the
translation loop.
I believe a proper fix would be to turn all of these "fake" exceptions into
DISAS_FOO constants, to be assigned to is_jmp. There are a bunch of
DISAS_TARGET_N enumerators which should be renamed like in target/arm/translate.h:
#define DISAS_WFI DISAS_TARGET_2
#define DISAS_SWI DISAS_TARGET_3
etc. Then most of the code that is special casing these constants should get
moved to ppc_tr_tb_stop.
r~
next prev parent reply other threads:[~2021-04-29 17:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 17:16 [PATCH v2 00/15] Base for adding PowerPC 64-bit instructions Luis Pires
2021-04-27 17:16 ` [PATCH v2 01/15] decodetree: Add support for " Luis Pires
2021-04-27 17:16 ` [PATCH v2 02/15] target/ppc: Add cia field to DisasContext Luis Pires
2021-04-28 14:55 ` Richard Henderson
2021-04-28 14:59 ` Luis Fernando Fujita Pires
2021-04-27 17:16 ` [PATCH v2 03/15] target/ppc: Split out decode_legacy Luis Pires
2021-04-27 17:16 ` [PATCH v2 04/15] target/ppc: Move DISAS_NORETURN setting into gen_exception* Luis Pires
2021-04-28 15:05 ` Richard Henderson
2021-04-29 17:07 ` Luis Fernando Fujita Pires
2021-04-29 17:21 ` Richard Henderson [this message]
2021-04-27 17:16 ` [PATCH v2 05/15] target/ppc: Tidy exception vs exit_tb Luis Pires
2021-04-27 17:16 ` [PATCH v2 06/15] target/ppc: Mark helper_raise_exception* as noreturn Luis Pires
2021-04-27 17:16 ` [PATCH v2 07/15] target/ppc: Use translator_loop_temp_check Luis Pires
2021-04-27 17:16 ` [PATCH v2 08/15] target/ppc: Add infrastructure for prefixed insns Luis Pires
2021-04-27 17:16 ` [PATCH v2 09/15] target/ppc: Move ADDI, ADDIS to decodetree, implement PADDI Luis Pires
2021-04-28 14:10 ` Matheus K. Ferst
2021-04-28 15:23 ` Richard Henderson
2021-04-27 17:16 ` [PATCH v2 10/15] target/ppc: Implement PNOP Luis Pires
2021-04-27 17:16 ` [PATCH v2 11/15] target/ppc: Move D/DS/X-form integer loads to decodetree Luis Pires
2021-04-28 13:31 ` Matheus K. Ferst
2021-04-28 15:34 ` Richard Henderson
2021-04-27 17:16 ` [PATCH v2 12/15] target/ppc: Implement prefixed integer load instructions Luis Pires
2021-04-27 17:16 ` [PATCH v2 13/15] target/ppc: Move D/DS/X-form integer stores to decodetree Luis Pires
2021-04-27 17:16 ` [PATCH v2 14/15] target/ppc: Implement prefixed integer store instructions Luis Pires
2021-04-27 17:16 ` [PATCH v2 15/15] target/ppc: Check cpu flags for prefixed insn support Luis Pires
2021-04-28 15:37 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92e7200b-a4fd-7595-785d-dbdd24f37414@linaro.org \
--to=richard.henderson@linaro.org \
--cc=bruno.larsen@eldorado.org.br \
--cc=david@gibson.dropbear.id.au \
--cc=f4bug@amsat.org \
--cc=lagarcia@br.ibm.com \
--cc=luis.pires@eldorado.org.br \
--cc=matheus.ferst@eldorado.org.br \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).