qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
To: <ltaylorsimpson@gmail.com>
Cc: <quic_mathbern@quicinc.com>, <qemu-devel@nongnu.org>,
	<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 15:02:14 -0300	[thread overview]
Message-ID: <20240429181010.2160-1-quic_mathbern@quicinc.com> (raw)
In-Reply-To: <028e01da9a44_b05d2940_11177bc0_@gmail.com>

Hi, Taylor

On Mon, 29 Apr 2024 09:51:16 -0500 <ltaylorsimpson@gmail.com> wrote:
>
> 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.
 
Will do, thanks.

> > -----Original Message-----
> > From: ltaylorsimpson@gmail.com <ltaylorsimpson@gmail.com>
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: 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.

Actually, I had missed this spot and I think we do need the check at 
gen_write_new_pc_pcrel too. The added test `unaligned_pc_multi_cof.S` will
exercise it with a relative PC addr that is not aligned. I'll fix that, thanks. 

> > > 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.

Good idea, will do.


       reply	other threads:[~2024-04-29 18:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <028e01da9a44_b05d2940_11177bc0_@gmail.com>
2024-04-29 18:02 ` Matheus Tavares Bernardino [this message]
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

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=20240429181010.2160-1-quic_mathbern@quicinc.com \
    --to=quic_mathbern@quicinc.com \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=bcain@quicinc.com \
    --cc=ltaylorsimpson@gmail.com \
    --cc=qemu-devel@nongnu.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 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).