qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH]: sh4 delay slot code update
Date: Thu, 29 Nov 2007 14:55:34 +0900	[thread overview]
Message-ID: <20071129055534.GA27339@linux-sh.org> (raw)
In-Reply-To: <aec7e5c30711282143y7cc6d1d0ue169663e71b346c8@mail.gmail.com>

On Thu, Nov 29, 2007 at 02:43:03PM +0900, Magnus Damm wrote:
> On Nov 28, 2007 9:49 PM, Paul Mundt <lethal@linux-sh.org> wrote:
> I was mainly wondering if I really needed to save the state of SR_T,
> but I assumed so. So the code should be correct. And yes, I'm sure
> there are quite a few slottable instructions with interesting side
> effects, but that's a separate issue.
> 
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.

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

  reply	other threads:[~2007-11-29  6:28 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 [this message]
2007-11-29  9:18       ` Magnus Damm
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=20071129055534.GA27339@linux-sh.org \
    --to=lethal@linux-sh.org \
    --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).