diff mbox

[6/9] sparc64: clear exception_index with -1 value

Message ID 20100105231933.6526.79032.stgit@skyserv
State New
Headers show

Commit Message

Igor V. Kovalenko Jan. 5, 2010, 11:19 p.m. UTC
From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
---
 target-sparc/op_helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Blue Swirl Jan. 6, 2010, 5:36 p.m. UTC | #1
Thanks, applied.

On Tue, Jan 5, 2010 at 11:19 PM, Igor V. Kovalenko
<igor.v.kovalenko@gmail.com> wrote:
> From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>
> Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
> ---
>  target-sparc/op_helper.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
> index b1978cb..94f1c7a 100644
> --- a/target-sparc/op_helper.c
> +++ b/target-sparc/op_helper.c
> @@ -3535,7 +3535,7 @@ void do_interrupt(CPUState *env)
>     env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5);
>     env->pc = env->tbr;
>     env->npc = env->pc + 4;
> -    env->exception_index = 0;
> +    env->exception_index = -1;
>  }
>  #else
>  #ifdef DEBUG_PCALL
>
>
>
>
Artyom Tarasenko Jan. 6, 2010, 11:29 p.m. UTC | #2
What's the effect of the patch? Don't we need it for sparc32 too? The
code looks similar.

2010/1/6 Blue Swirl <blauwirbel@gmail.com>:
> Thanks, applied.
>
> On Tue, Jan 5, 2010 at 11:19 PM, Igor V. Kovalenko
> <igor.v.kovalenko@gmail.com> wrote:
>> From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>>
>> Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>> ---
>>  target-sparc/op_helper.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
>> index b1978cb..94f1c7a 100644
>> --- a/target-sparc/op_helper.c
>> +++ b/target-sparc/op_helper.c
>> @@ -3535,7 +3535,7 @@ void do_interrupt(CPUState *env)
>>     env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5);
>>     env->pc = env->tbr;
>>     env->npc = env->pc + 4;
>> -    env->exception_index = 0;
>> +    env->exception_index = -1;
>>  }
>>  #else
>>  #ifdef DEBUG_PCALL
>>
>>
>>
>>
>
>
>
Igor V. Kovalenko Jan. 6, 2010, 11:57 p.m. UTC | #3
On Thu, Jan 7, 2010 at 2:29 AM, Artyom Tarasenko
<atar4qemu@googlemail.com> wrote:
> What's the effect of the patch? Don't we need it for sparc32 too? The
> code looks similar.
>
> 2010/1/6 Blue Swirl <blauwirbel@gmail.com>:
>> Thanks, applied.
>>
>> On Tue, Jan 5, 2010 at 11:19 PM, Igor V. Kovalenko
>> <igor.v.kovalenko@gmail.com> wrote:
>>> From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>>>
>>> Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>>> ---
>>>  target-sparc/op_helper.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
>>> index b1978cb..94f1c7a 100644
>>> --- a/target-sparc/op_helper.c
>>> +++ b/target-sparc/op_helper.c
>>> @@ -3535,7 +3535,7 @@ void do_interrupt(CPUState *env)
>>>     env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5);
>>>     env->pc = env->tbr;
>>>     env->npc = env->pc + 4;
>>> -    env->exception_index = 0;
>>> +    env->exception_index = -1;
>>>  }
>>>  #else
>>>  #ifdef DEBUG_PCALL

Right, but that's out of scope for this changeset.

In fact sparc32 should have the same issue, as well as alpha, s390 and
sh4. Check in cpu_exec() for valid exception_index is "greater or
equal to zero" so all those targets should be corrected. On sh4 we
even check for "invalid value of exception_index is -1"
Blue Swirl Jan. 7, 2010, 8:05 p.m. UTC | #4
On Wed, Jan 6, 2010 at 11:57 PM, Igor Kovalenko
<igor.v.kovalenko@gmail.com> wrote:
> On Thu, Jan 7, 2010 at 2:29 AM, Artyom Tarasenko
> <atar4qemu@googlemail.com> wrote:
>> What's the effect of the patch? Don't we need it for sparc32 too? The
>> code looks similar.
>>
>> 2010/1/6 Blue Swirl <blauwirbel@gmail.com>:
>>> Thanks, applied.
>>>
>>> On Tue, Jan 5, 2010 at 11:19 PM, Igor V. Kovalenko
>>> <igor.v.kovalenko@gmail.com> wrote:
>>>> From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>>>>
>>>> Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>>>> ---
>>>>  target-sparc/op_helper.c |    2 +-
>>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
>>>> index b1978cb..94f1c7a 100644
>>>> --- a/target-sparc/op_helper.c
>>>> +++ b/target-sparc/op_helper.c
>>>> @@ -3535,7 +3535,7 @@ void do_interrupt(CPUState *env)
>>>>     env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5);
>>>>     env->pc = env->tbr;
>>>>     env->npc = env->pc + 4;
>>>> -    env->exception_index = 0;
>>>> +    env->exception_index = -1;
>>>>  }
>>>>  #else
>>>>  #ifdef DEBUG_PCALL
>
> Right, but that's out of scope for this changeset.
>
> In fact sparc32 should have the same issue, as well as alpha, s390 and
> sh4. Check in cpu_exec() for valid exception_index is "greater or
> equal to zero" so all those targets should be corrected. On sh4 we
> even check for "invalid value of exception_index is -1"

Thanks, I applied the fix for Sparc32. Here's also an untested fix for
other architectures.
diff mbox

Patch

diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index b1978cb..94f1c7a 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -3535,7 +3535,7 @@  void do_interrupt(CPUState *env)
     env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5);
     env->pc = env->tbr;
     env->npc = env->pc + 4;
-    env->exception_index = 0;
+    env->exception_index = -1;
 }
 #else
 #ifdef DEBUG_PCALL