From: Dave Denholm <ddenholm@esmertec.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] BUG: qemu-sh4 - shar does logical not arithmetic right shift
Date: Sun, 13 Jan 2008 14:53:46 +0000 [thread overview]
Message-ID: <km1w8lvksl.fsf@dalmore.esmertec.com> (raw)
In-Reply-To: <E1HnH2m-0003IA-3l@cvs> (Thiemo Seufer's message of "Sun, 13 May 2007 16:35:36 +0000")
Thiemo Seufer <ths@networkno.de> writes:
(in May 2007)
> CVSROOT: /sources/qemu
> Module name: qemu
> Changes by: Thiemo Seufer <ths> 07/05/13 16:35:36
>
> Modified files:
> target-sh4 : op.c
>
> Log message:
> Remove unnecessary pointer magic in shift operations, by Magnus Damm.
>
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/qemu/target-sh4/op.c?cvsroot=qemu&r1=1.4&r2=1.5
>
Hi,
I'm just playing with qemu-sh4, and found that 'shar' seems to be doing
a logical right shift, rather than an arithmetic right shift.
I think that pointer magic was necessary after all.
In the current version of target-sh4/op.c, op_shar_Rn() and op_shlr_Rn() are identical,
which is surely wrong.
void OPPROTO op_shar_Rn(void)
{
cond_t(env->gregs[PARAM1] & 1);
env->gregs[PARAM1] >>= 1;
RETURN();
}
void OPPROTO op_shlr_Rn(void)
{
cond_t(env->gregs[PARAM1] & 1);
env->gregs[PARAM1] >>= 1;
RETURN();
}
The behaviour is consistent with env->gregs[] being an array of unsigned ints,
(I'm not familiar with qemu details...) and so to get an arithmetic shift, some
kind of cast is necessary.
dd
--
Dave Denholm <ddenholm@esmertec.com> http://www.esmertec.com
prev parent reply other threads:[~2008-01-13 14:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-13 16:35 [Qemu-devel] qemu/target-sh4 op.c Thiemo Seufer
2008-01-13 14:53 ` Dave Denholm [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=km1w8lvksl.fsf@dalmore.esmertec.com \
--to=ddenholm@esmertec.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 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.