All of lore.kernel.org
 help / color / mirror / Atom feed
From: <ltaylorsimpson@gmail.com>
To: "'Brian Cain'" <brian.cain@oss.qualcomm.com>, <qemu-devel@nongnu.org>
Cc: <richard.henderson@linaro.org>, <philmd@linaro.org>,
	<matheus.bernardino@oss.qualcomm.com>, <ale@rev.ng>,
	<anjo@rev.ng>, <marco.liebel@oss.qualcomm.com>,
	<alex.bennee@linaro.org>, <quic_mburton@quicinc.com>,
	<sidneym@quicinc.com>
Subject: RE: [PATCH v3 5/5] target/hexagon: Remove unreachable
Date: Mon, 14 Apr 2025 11:19:38 -0600	[thread overview]
Message-ID: <058801dbad61$68ff5b00$3afe1100$@gmail.com> (raw)
In-Reply-To: <20250407192705.2605614-6-brian.cain@oss.qualcomm.com>



> -----Original Message-----
> From: Brian Cain <brian.cain@oss.qualcomm.com>
> Sent: Monday, April 7, 2025 1:27 PM
> To: qemu-devel@nongnu.org
> Cc: brian.cain@oss.qualcomm.com; richard.henderson@linaro.org;
> philmd@linaro.org; matheus.bernardino@oss.qualcomm.com; ale@rev.ng;
> anjo@rev.ng; marco.liebel@oss.qualcomm.com; ltaylorsimpson@gmail.com;
> alex.bennee@linaro.org; quic_mburton@quicinc.com;
> sidneym@quicinc.com
> Subject: [PATCH v3 5/5] target/hexagon: Remove unreachable
> 
> We should raise an exception in the event that we encounter a packet that
> can't be correctly decoded, not fault.
> 
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
>  target/hexagon/decode.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/target/hexagon/decode.c b/target/hexagon/decode.c index
> b5ece60450..1db7f1950f 100644
> --- a/target/hexagon/decode.c
> +++ b/target/hexagon/decode.c
> @@ -489,7 +489,6 @@ decode_insns(DisasContext *ctx, Insn *insn, uint32_t
> encoding)
>              insn->iclass = iclass_bits(encoding);
>              return 1;
>          }
> -        g_assert_not_reached();
>      } else {
>          uint32_t iclass = get_duplex_iclass(encoding);
>          unsigned int slot0_subinsn = get_slot0_subinsn(encoding); @@ -512,6
> +511,11 @@ decode_insns(DisasContext *ctx, Insn *insn, uint32_t encoding)
>          }
>          g_assert_not_reached();

Why leave this one rather than raising an exception?

>      }
> +    /*
> +     * invalid/unrecognized opcode; return 1 and let gen_insn() raise an
> +     * exception when it sees this empty insn.
> +     */
> +    return 1;

You should set insn->generate to NULL if you want to guarantee that gen_insn will raise an exception.  A better option is to return a special value that indicates "invalid" and have decode_packet return 0 which will cause decode_and_translate_packet to generate the exception before generating the code for any other instructions in the packet.

Do you have a test case for this?

Taylor




  reply	other threads:[~2025-04-14 17:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 19:27 [PATCH v3 0/5] misc hexagon patches Brian Cain
2025-04-07 19:27 ` [PATCH v3 1/5] target/hexagon: handle .new values Brian Cain
2025-04-14 16:47   ` ltaylorsimpson
2025-04-07 19:27 ` [PATCH v3 2/5] target/hexagon: Fix badva reference, delete CAUSE Brian Cain
2025-04-14 16:53   ` ltaylorsimpson
2025-04-07 19:27 ` [PATCH v3 3/5] target/hexagon: Add missing A_CALL attr, hintjumpr to multi_cof Brian Cain
2025-04-14 17:04   ` ltaylorsimpson
2025-04-15 18:22     ` Brian Cain
2025-04-15 23:31       ` ltaylorsimpson
2025-04-07 19:27 ` [PATCH v3 4/5] target/hexagon: s/pkt_has_store/pkt_has_scalar_store Brian Cain
2025-04-14 17:06   ` ltaylorsimpson
2025-04-07 19:27 ` [PATCH v3 5/5] target/hexagon: Remove unreachable Brian Cain
2025-04-14 17:19   ` ltaylorsimpson [this message]
2025-04-07 19:37 ` [PATCH v3 0/5] misc hexagon patches Matheus Tavares Bernardino
     [not found] <058801dbad61_68ff5b00_3afe1100_@gmail.com>
2025-04-14 18:09 ` [PATCH v3 5/5] target/hexagon: Remove unreachable Matheus Tavares Bernardino
2025-04-14 20:59   ` ltaylorsimpson
2025-04-16 22:21     ` Brian Cain
2025-04-16 23:27       ` ltaylorsimpson

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='058801dbad61$68ff5b00$3afe1100$@gmail.com' \
    --to=ltaylorsimpson@gmail.com \
    --cc=ale@rev.ng \
    --cc=alex.bennee@linaro.org \
    --cc=anjo@rev.ng \
    --cc=brian.cain@oss.qualcomm.com \
    --cc=marco.liebel@oss.qualcomm.com \
    --cc=matheus.bernardino@oss.qualcomm.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quic_mburton@quicinc.com \
    --cc=richard.henderson@linaro.org \
    --cc=sidneym@quicinc.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.