qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Steven Seeger <steven.seeger@flightsystems.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Artyom Tarasenko <atar4qemu@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 01/02] fix issue where a branch to pc+4 confuses GDB because pc and npc are set to the same value
Date: Thu, 15 Feb 2018 16:03:05 -0500	[thread overview]
Message-ID: <3370102.LRrLPoLVVs@wirbelwind> (raw)
In-Reply-To: <CAFEAcA_xHpd5_RVp4_Be3wOa_U6YTpN0wiKheMYApuSOkbtjHw@mail.gmail.com>

On Thursday, February 15, 2018 2:39:34 PM EST Peter Maydell wrote:
> On 15 February 2018 at 19:15, Steven Seeger
> These changes look rather odd -- are you sure they're right?
> This is the code for unconditional taken branch, not annulled, and
> my copy of the sparc architecture manual says that in that case
> the new PC value should be the old nPC value, and the new
> nPC value should be the effective address of the branch target.
> There's nothing in there about branches into your own delay
> slot being a special case. Adding 4 to target like this will
> make the new nPC value be 4 further forward, which would mean
> we'd only execute the branch target instruction once, rather
> than twice (once for it being in the branch delay slot and
> once as the instruction target).
> 
> It's a weird thing to do so I wouldn't be surprised if gdb
> mishandled it. Have you tested against real sparc hardware?
> 
> thanks
> -- PMM

Hi Peter. Thank you for the thoughtful reply. I did not consider the 
possibility that in this case the instruction should execute twice. The issue 
here is that when stepping through code in gdb, after the branch to the delay 
slot, pc==npc. So subsequent steps actually go nowhere. This could maybe be a 
problem with GDB, but I don't think so.

I will have access to real hardware Tuesday and will test this case.

If the instruction should execute twice, then we may need to kick npc in qemu 
in order to alleviate this.

Steven

  reply	other threads:[~2018-02-15 21:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 19:15 [Qemu-devel] [PATCH 01/02] fix issue where a branch to pc+4 confuses GDB because pc and npc are set to the same value Steven Seeger
2018-02-15 19:39 ` Peter Maydell
2018-02-15 21:03   ` Steven Seeger [this message]
2018-02-15 21:06   ` Steven Seeger
2018-02-16  3:01   ` Steven Seeger

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=3370102.LRrLPoLVVs@wirbelwind \
    --to=steven.seeger@flightsystems.net \
    --cc=atar4qemu@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).