Before creating and posting the patch, it was a consensus that using the
l.movhi instruction was a better way to clear register values (since it
doesn't require any register as input) than the other ways of doing it.  I
haven't downloaded the kernel since Dec., so I don't know what all has been
changed.  It is essential that the CLEAR_GPR macro be changed (as in the
patch) as it relies on r0 == 0, which may not be true, especially when
resetting r0.

Your version of my changes may not work in simulation.  It depends on how X
values are propagated.

Back to Mr. Diez's orginial question, the best way is to follow the same
protocol as in my patch.


---Matthew Hicks


On Tue, Mar 20, 2012 at 10:34 AM, Jonas Bonn <[email protected]> wrote:

>
> On Tue, 2012-03-20 at 10:14 -0500, Matthew Hicks wrote:
> > Here is a link to the patch I
> > submitted:
> http://lists.openrisc.net/pipermail/openrisc/2011-December/000560.html
> >
>
> This has been in the kernel for a while already.  See below...  Or are
> you saying that the below doesn't actually work?
>
> /Jonas
>
> commit 61d79baa21f0cff6697fd3172c8cf3685467441e
> Author: Jonas Bonn <[email protected]>
> Date:   Mon Jan 10 17:10:42 2011 +0100
>
>    Clear r0 at startup
>
>    r0 is "always zero" by convention only and there's no guarantee that
>    the hardware actually sets its value to zero, so do it explicitly at
>    startup just to be sure.  This doesn't actually cost anything as we
>    can sneak it into the delay slot of the jump in the reset vector
> where
>    we previously had a l.nop.
>
> diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
> index c400de0..4f88c02 100644
> --- a/arch/openrisc/kernel/entry.S
> +++ b/arch/openrisc/kernel/entry.S
> @@ -267,7 +267,7 @@
> handler:                                                    ;\
>
>  EXCEPTION_ENTRY(_tng_kernel_start)
>        l.jal   _start
> -       l.nop
> +        l.andi r0,r0,0
>
>  /* ---[ 0x200: BUS exception
> ]------------------------------------------- */
>
>
>
>
>
_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc

Reply via email to