qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Magnus Damm" <magnus.damm@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH]: sh4 delay slot code update
Date: Thu, 29 Nov 2007 18:18:32 +0900	[thread overview]
Message-ID: <aec7e5c30711290118i3ff8b13bpde12b695c90ece60@mail.gmail.com> (raw)
In-Reply-To: <20071129055534.GA27339@linux-sh.org>

On Nov 29, 2007 2:55 PM, Paul Mundt <lethal@linux-sh.org> wrote:
> The only thing to be careful of is the ordering semantics for the T-bit
> state, which is what I tried to convey in the code snippet.
>
> > > You can see an example in arch/sh/kernel/entry-common.S:
> > >
> > >         syscall_exit_work:
> > >                 ! r0: current_thread_info->flags
> > >                 ! r8: current_thread_info
> > >                 tst     #_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | _TIF_SYSCALL_AUDIT, r0
> > >                 bt/s    work_pending
> > >                  tst    #_TIF_NEED_RESCHED, r0
> > >
> > >         ....
> > >         work_pending:
> > >                 ! r0: current_thread_info->flags
> > >                 ! r8: current_thread_info
> > >                 ! t:  result of "tst    #_TIF_NEED_RESCHED, r0"
> > >                 bf/s    work_resched
> > >                  tst    #(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), r0
> > >
> So while bt/s is conditional on the first flag test, the T-state is
> relative to the second test by the time the branch happens.

Exactly.

> The T-state check for bt/bf happens _prior_ to execution of the delay
> slot instruction, while any delay-slot resident T-bit modifier is
> executed by the time we enter the branch. I don't know if your code
> handles that or not, but figured it's probably good to make that
> explicit. T-bit modifiers are always a bit hairy..

Yeah, the T flag is indeed a bit hairy. The patch should handle the T
bit exactly as you describe it. As part of the bt/bf instruction the T
flag is evaluated and if true the the DELAY_SLOT_TRUE bit is set. This
bit is later used to decide if we should jump or not after the delay
slot instruction.

Thank you,

/ magnus

  reply	other threads:[~2007-11-29  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-28  9:54 [Qemu-devel] [PATCH]: sh4 delay slot code update Magnus Damm
2007-11-28 12:49 ` Paul Mundt
2007-11-29  5:43   ` Magnus Damm
2007-11-29  5:55     ` Paul Mundt
2007-11-29  9:18       ` Magnus Damm [this message]
2007-11-29  9:30         ` Paul Mundt

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=aec7e5c30711290118i3ff8b13bpde12b695c90ece60@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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).