* [Qemu-devel] sparc: potentially incorrect if dynamic npc?
@ 2010-04-20 15:53 Artyom Tarasenko
2010-04-20 16:11 ` [Qemu-devel] " Blue Swirl
0 siblings, 1 reply; 4+ messages in thread
From: Artyom Tarasenko @ 2010-04-20 15:53 UTC (permalink / raw)
To: Blue Swirl, qemu-devel
/* XXX: potentially incorrect if dynamic npc */
static void do_branch
There are few comments like this in target-sparc/translate.c .
In what case is it incorrect?
Can do_branch functions be called with dynamic npc?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: sparc: potentially incorrect if dynamic npc?
2010-04-20 15:53 [Qemu-devel] sparc: potentially incorrect if dynamic npc? Artyom Tarasenko
@ 2010-04-20 16:11 ` Blue Swirl
2010-04-20 16:55 ` Artyom Tarasenko
0 siblings, 1 reply; 4+ messages in thread
From: Blue Swirl @ 2010-04-20 16:11 UTC (permalink / raw)
To: Artyom Tarasenko; +Cc: qemu-devel
On 4/20/10, Artyom Tarasenko <atar4qemu@googlemail.com> wrote:
> /* XXX: potentially incorrect if dynamic npc */
> static void do_branch
>
> There are few comments like this in target-sparc/translate.c .
> In what case is it incorrect?
>
> Can do_branch functions be called with dynamic npc?
Maybe, if there are two branches or jumps in a row. The last time I
checked, at least for successive branches we do the correct thing.
It's pretty obscure, no compiler will generate such sequences and
nobody with asm skills either.
Another corner case that IIRC we don't handle is where a jump
instruction is at the end of the page and its delay slot instruction
is at next page. I think one commit for Microblaze added support for
this case.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: sparc: potentially incorrect if dynamic npc?
2010-04-20 16:11 ` [Qemu-devel] " Blue Swirl
@ 2010-04-20 16:55 ` Artyom Tarasenko
2010-04-20 17:07 ` Blue Swirl
0 siblings, 1 reply; 4+ messages in thread
From: Artyom Tarasenko @ 2010-04-20 16:55 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
2010/4/20 Blue Swirl <blauwirbel@gmail.com>:
> On 4/20/10, Artyom Tarasenko <atar4qemu@googlemail.com> wrote:
>> /* XXX: potentially incorrect if dynamic npc */
>> static void do_branch
>>
>> There are few comments like this in target-sparc/translate.c .
>> In what case is it incorrect?
>>
>> Can do_branch functions be called with dynamic npc?
>
> Maybe, if there are two branches or jumps in a row. The last time I
> checked, at least for successive branches we do the correct thing.
> It's pretty obscure, no compiler will generate such sequences and
> nobody with asm skills either.
Why not? That's how you can implement a very compact 'case'
operator in asm. It is used in OBP.
But you are right, this seems to work (at least with ss-5 and
ss-20 OBP).
> Another corner case that IIRC we don't handle is where a jump
> instruction is at the end of the page and its delay slot instruction
> is at next page.
Do you mean that npc is dynamic in this case, or that if
npc is dynamic and the instruction is at the end of the page we have
a problem?
> I think one commit for Microblaze added support for
> this case.
--
Regards,
Artyom Tarasenko
solaris/sparc under qemu blog: http://tyom.blogspot.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: sparc: potentially incorrect if dynamic npc?
2010-04-20 16:55 ` Artyom Tarasenko
@ 2010-04-20 17:07 ` Blue Swirl
0 siblings, 0 replies; 4+ messages in thread
From: Blue Swirl @ 2010-04-20 17:07 UTC (permalink / raw)
To: Artyom Tarasenko; +Cc: qemu-devel
On 4/20/10, Artyom Tarasenko <atar4qemu@googlemail.com> wrote:
> 2010/4/20 Blue Swirl <blauwirbel@gmail.com>:
>
> > On 4/20/10, Artyom Tarasenko <atar4qemu@googlemail.com> wrote:
> >> /* XXX: potentially incorrect if dynamic npc */
> >> static void do_branch
> >>
> >> There are few comments like this in target-sparc/translate.c .
> >> In what case is it incorrect?
> >>
> >> Can do_branch functions be called with dynamic npc?
> >
> > Maybe, if there are two branches or jumps in a row. The last time I
> > checked, at least for successive branches we do the correct thing.
> > It's pretty obscure, no compiler will generate such sequences and
> > nobody with asm skills either.
>
>
> Why not? That's how you can implement a very compact 'case'
> operator in asm. It is used in OBP.
>
> But you are right, this seems to work (at least with ss-5 and
> ss-20 OBP).
>
>
> > Another corner case that IIRC we don't handle is where a jump
> > instruction is at the end of the page and its delay slot instruction
> > is at next page.
>
>
> Do you mean that npc is dynamic in this case, or that if
> npc is dynamic and the instruction is at the end of the page we have
> a problem?
The problem is with code generation in general (delay slot instruction
gets translated effectively before the branch), could be related to
dynamic npc too but the branch could be bn or ba as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-20 17:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-20 15:53 [Qemu-devel] sparc: potentially incorrect if dynamic npc? Artyom Tarasenko
2010-04-20 16:11 ` [Qemu-devel] " Blue Swirl
2010-04-20 16:55 ` Artyom Tarasenko
2010-04-20 17:07 ` Blue Swirl
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).