From: <ltaylorsimpson@gmail.com>
To: "'Matheus Tavares Bernardino'" <quic_mathbern@quicinc.com>,
<qemu-devel@nongnu.org>
Cc: <bcain@quicinc.com>, <sidneym@quicinc.com>, <ale@rev.ng>, <anjo@rev.ng>
Subject: RE: [PATCH] Hexagon: add PC alignment check and exception
Date: Mon, 29 Apr 2024 09:51:16 -0500 [thread overview]
Message-ID: <028e01da9a44$b05d2940$11177bc0$@gmail.com> (raw)
In-Reply-To: <028d01da9a43$3503f8b0$9f0bea10$@gmail.com>
PS You should also update the pkt_raises_exception function in translate.c
to return true for packets that contain these instructions. This will
ensure that none of the machine state is changed before the check is
complete.
Taylor
> -----Original Message-----
> From: ltaylorsimpson@gmail.com <ltaylorsimpson@gmail.com>
> Sent: Monday, April 29, 2024 9:41 AM
> To: 'Matheus Tavares Bernardino' <quic_mathbern@quicinc.com>; qemu-
> devel@nongnu.org
> Cc: bcain@quicinc.com; sidneym@quicinc.com; ale@rev.ng; anjo@rev.ng
> Subject: RE: [PATCH] Hexagon: add PC alignment check and exception
>
>
>
> > -----Original Message-----
> > From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> > Sent: Friday, April 26, 2024 1:16 PM
> > To: qemu-devel@nongnu.org
> > Cc: bcain@quicinc.com; sidneym@quicinc.com; ale@rev.ng; anjo@rev.ng;
> > ltaylorsimpson@gmail.com
> > Subject: [PATCH] Hexagon: add PC alignment check and exception
> >
> > The Hexagon Programmer's Reference Manual says that the exception
> 0x1e
> > should be raised upon an unaligned program counter. Let's implement
> > that and also add tests for both the most common case as well as
> > packets with multiple change-of-flow instructions.
> >
> > Signed-off-by: Matheus Tavares Bernardino
> <quic_mathbern@quicinc.com>
> > ---
>
>
> > --- a/target/hexagon/genptr.c
> > +++ b/target/hexagon/genptr.c
> > @@ -473,6 +473,7 @@ static void gen_write_new_pc_addr(DisasContext
>
> You haven't added the check to gen_write_new_pc_pcrel. It's not needed
> there because the encoding guarantees the target is always aligned -
right?
> However, there is a call to gen_write_new_pc_addr inside that function.
In
> this case, we'll add a check that isn't necessary. Consider adding a
parameter
> to indicate if the check can be avoided.
>
>
> > a/tests/tcg/hexagon/Makefile.target
> > b/tests/tcg/hexagon/Makefile.target
> > index f839b2c0d5..02d7fff34c 100644
> > --- a/tests/tcg/hexagon/Makefile.target
> > +++ b/tests/tcg/hexagon/Makefile.target
> > @@ -51,6 +51,19 @@ HEX_TESTS += scatter_gather HEX_TESTS +=
> hvx_misc
> > HEX_TESTS += hvx_histogram HEX_TESTS += invalid-slots
> > +HEX_TESTS += unaligned_pc
> > +HEX_TESTS += unaligned_pc_multi_cof
> > +
> > +run-unaligned_pc: unaligned_pc
> > +run-unaligned_pc_multi_cof: unaligned_pc_multi_cof run-unaligned_pc
> > +run-unaligned_pc_multi_cof:
> > + $(call run-test, $<, $(QEMU) $< 2> $<.stderr,"$< on
> > $(TARGET_NAME)"); \
> > + if [ $$? -ne 1 ] ; then \
> > + return 1; \
> > + fi
> > + $(call quiet-command, \
> > + grep -q "exception 0x1e" $<.stderr, \
> > + "GREP", "exception 0x1e");
>
> We should also test endloop instructions.
>
> Thanks,
> Taylor
>
next prev parent reply other threads:[~2024-04-29 14:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 18:15 [PATCH] Hexagon: add PC alignment check and exception Matheus Tavares Bernardino
2024-04-27 3:50 ` Brian Cain
2024-04-27 14:56 ` Richard Henderson
2024-04-29 18:19 ` Richard Henderson
2024-04-29 14:40 ` ltaylorsimpson
2024-04-29 14:51 ` ltaylorsimpson [this message]
[not found] <028e01da9a44_b05d2940_11177bc0_@gmail.com>
2024-04-29 18:02 ` Matheus Tavares Bernardino
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='028e01da9a44$b05d2940$11177bc0$@gmail.com' \
--to=ltaylorsimpson@gmail.com \
--cc=ale@rev.ng \
--cc=anjo@rev.ng \
--cc=bcain@quicinc.com \
--cc=qemu-devel@nongnu.org \
--cc=quic_mathbern@quicinc.com \
--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 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).