[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [4875] Remove unintended dereference, kills a warning (
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] Re: [4875] Remove unintended dereference, kills a warning (Jan Kiszka). |
Date: |
Wed, 16 Jul 2008 14:35:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
Laurent Desnogues wrote:
> On Wed, Jul 16, 2008 at 2:04 PM, Andreas Schwab <address@hidden> wrote:
>> Andrzej Zaborowski <address@hidden> 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();
}