On Tue, 2012-03-20 at 15:30 +0200, Stefan Kristiansson wrote:
> On Tue, Mar 20, 2012 at 10:06:16AM +0000, R. Diez wrote:
> > Hi all:
> > 
> > I found the following about R0 in the architecture specification:
> > 
> > 
> > > R0 is used as a constant zero.
> > 
> > That is the basic assumption which everybody counts upon, therefore...
> > 
> > 
> > > R0 should never be used as a destination register.
> > 
> > I would add here "except for clearing it on start-up".
> > 
> 
> I agree

I don't agree... in the same way that you don't have to respect any ABI
as long as you aren't calling into "external" code, you are free to
fiddle with r0 as much as you want.  "r0 contains 0" is ABI, it is not a
hardware detail.  A bit weird, I agree, but not fundamentally incorrect.

The real problem is that r0 isn't _necessarily_ writable... so there's
no guarantee that you can actually run a program that changes r0 on an
arbitrary implementation.

/Jonas

> 
> > 
> > > An implementation is not required to initialize GPRs to zero during the 
> > > reset procedure.
> > 
> > I would add here "except for R0, which must be cleared on start-up".
> > 
> > Otherwise, R0 may not be 0 after all, and that would be a violation of the 
> > assumption above.
> > 
> 
> Except it should be cleared by software on start-up, the sentence you quoted
> speaks about hardware not being required to clear them upon reset.
> 
> Stefan
> _______________________________________________
> OpenRISC mailing list
> [email protected]
> http://lists.openrisc.net/listinfo/openrisc


_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc

Reply via email to