From: Paul Mundt <lethal@linux-sh.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH]: sh4 delay slot code update
Date: Wed, 28 Nov 2007 21:49:17 +0900 [thread overview]
Message-ID: <20071128124917.GA29926@linux-sh.org> (raw)
In-Reply-To: <aec7e5c30711280154p35349b9aga2cc2da2aed8b12@mail.gmail.com>
On Wed, Nov 28, 2007 at 06:54:20PM +0900, Magnus Damm wrote:
> +#define DELAY_SLOT_TRUE (1 << 2)
> +#define DELAY_SLOT_CLEARME (1 << 3)
> +/* The dynamic value of the DELAY_SLOT_TRUE flag determines whether the jump
> + * after the delay slot should be taken or not. It is calculated from SR_T.
> + *
> + * It is unclear if it is permitted to modify the SR_T flag in a delay slot.
> + * The use of DELAY_SLOT_TRUE flag makes us accept such SR_T modification.
> + */
Nesting a 'tst' in a delay slot is certainly valid, and GCC correctly
treats it as a slottable instruction. If you're in doubt as to whether an
opcode can be placed in a delay slot or not, the machine descriptor is a
good way of sorting things out. The only restrictions I know of things
that cause changes to PC, most of the system instructions (like trapa and
ldtlb), and so on. There are of course cases where an instruction itself
is slottable which may perform illegal behaviour via PC modification or
so on, and we do have an exception for trapping that sort of abuse.
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
....
This sort of access is not a particularly rare workload. Presumably you'd hit
this under system emulation at the very least.
next prev parent reply other threads:[~2007-11-28 12:49 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 [this message]
2007-11-29 5:43 ` Magnus Damm
2007-11-29 5:55 ` Paul Mundt
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=20071128124917.GA29926@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).