All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: steven.seeger@flightsystems.net, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] sparc branch to pc+4 issue
Date: Wed, 14 Feb 2018 18:02:28 +0000	[thread overview]
Message-ID: <1dbce0e5-6ba9-369a-2ba4-e7f6d5c5d085@ilande.co.uk> (raw)
In-Reply-To: <4476423.I6xtnU8gSc@wirbelwind>

On 13/02/18 20:57, Steven Seeger wrote:

> Consider pc==0x100:
> 
> 0x100   b 0x104
> 
> The uncondtional not-annulled branch will go to 0x104, which is the next
> instruction anyway. do_branch() will leave dc->pc and dc->npc both set to
> 0x104. This causes gdb to have a problem when single stepping. It will be
> stuck. QEMU will execute past this somehow, but I'm not sure with what side
> effect. It seems to me the following patch will fix this:
> 
> diff --git a/target/sparc/translate.c b/target/sparc/translate.c
> index 71e0853e43..95ca90b51a 100644
> --- a/target/sparc/translate.c
> +++ b/target/sparc/translate.c
> @@ -1464,6 +1464,7 @@ static void do_branch(DisasContext *dc, int32_t offset,
> uint32_t insn, int cc)
>               dc->npc = dc->pc + 4;
>           } else {
>               dc->pc = dc->npc;
> +            if(target==dc->pc) target += 4;
>               dc->npc = target;
>               tcg_gen_mov_tl(cpu_pc, cpu_npc);
>           }
> 
> I apologize if I am missing something with this assessment.

Hi Steven,

Thanks for the patch! In principle the patch looks good, although sadly 
I don't currently have access to real hardware to verify this. Also 
you'll need to add a Signed-off-by tag in order for your patch to be 
applied (see https://wiki.qemu.org/Contribute/SubmitAPatch for more 
details).


ATB,

Mark.

      reply	other threads:[~2018-02-14 18:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 20:57 [Qemu-devel] sparc branch to pc+4 issue Steven Seeger
2018-02-14 18:02 ` Mark Cave-Ayland [this message]

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=1dbce0e5-6ba9-369a-2ba4-e7f6d5c5d085@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=steven.seeger@flightsystems.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 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.