qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [4875] Remove unintended dereference, kills a warning (Jan Kiszka).
Date: Wed, 16 Jul 2008 14:35:57 +0200	[thread overview]
Message-ID: <487DEB2D.5040302@web.de> (raw)
In-Reply-To: <761ea48b0807160530k59412f39p6ae0c90c2756fb58@mail.gmail.com>

Laurent Desnogues wrote:
> On Wed, Jul 16, 2008 at 2:04 PM, Andreas Schwab <schwab@suse.de> wrote:
>> Andrzej Zaborowski <balrogg@gmail.com> writes:
>>
>>>  void OPPROTO op_tasb_rN(void)
>>>  {
>>> -    cond_t(*(int8_t *) env->gregs[PARAM1] == 0);
>>> -    *(int8_t *) env->gregs[PARAM1] |= 0x80;
>>> +    cond_t((env->gregs[PARAM1] && 0xff) == 0);
>>> +    *(int8_t *) &env->gregs[PARAM1] |= 0x80;
>> That does not make any sense at all.  The TAS insn operates on memory,
>> not on a register (atomic operations only make sense on memory anyway).
> 
> SH4 documentation says this:
> 
> TAS.B @Rn
>           If (Rn) = 0, 1 → T, else 0 → T
>           1 → MSB of (Rn)
> 
> So indeed it looks like Jan and Andrzej patch is wrong.

At least the audience is finally listening. ;)

Is this one better?

Index: qemu/target-sh4/op.c
===================================================================
--- qemu.orig/target-sh4/op.c
+++ qemu/target-sh4/op.c
@@ -594,8 +594,9 @@ void OPPROTO op_shlr16_Rn(void)
 
 void OPPROTO op_tasb_rN(void)
 {
-    cond_t(*(int8_t *) env->gregs[PARAM1] == 0);
-    *(int8_t *) env->gregs[PARAM1] |= 0x80;
+    uint8_t val = ldub(env->gregs[PARAM1]);
+    cond_t(val == 0);
+    stb(env->gregs[PARAM1], val | 0x80);
     RETURN();
 }
 

  reply	other threads:[~2008-07-16 12:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 11:31 [Qemu-devel] [4875] Remove unintended dereference, kills a warning (Jan Kiszka) Andrzej Zaborowski
2008-07-16 11:36 ` Laurent Desnogues
2008-07-16 12:10   ` [Qemu-devel] " Jan Kiszka
2008-07-16 12:04 ` [Qemu-devel] " Andreas Schwab
2008-07-16 12:30   ` Laurent Desnogues
2008-07-16 12:35     ` Jan Kiszka [this message]
2008-07-19  6:24       ` [Qemu-devel] " andrzej zaborowski
2008-08-18  7:13         ` Jan Kiszka

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=487DEB2D.5040302@web.de \
    --to=jan.kiszka@web.de \
    --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).