> WIKI: "R0 is used as a constant zero according to the ABI. R0 may or may
> not be hard-wired to zero in implementation. In the case where it is
> hard-wired to zero, no exception will be raised when it is used as a
> destination register."

I would write in the spec "no exception will be raised when a value of 0 is 
written to R0". This leaves the door open for any implementation where R0 is 
hard-wired to 0 to raise an exception when the software is trying to use R0 as 
a normal register.

I was actually going to suggest a _configurable flag_ in or1ksim in order to 
monitor writes to R0 and stop when the value is not zero. This would help 
ironing out any software bugs in ABI-conformant software that is forgetting to 
initialise R0 or that is writing non-zero values to it.

With this behaviour, there is no need to make a distinction between supervisor 
and user mode.

I wonder whether this complication is worth it at all. Are there any 
implementations out there which hard-wire R0 to 0? If not, we can just let R0 
be a normal register and leave this matter to the ABI specification. I don't 
think it's worth protecting the zero value of R0, as many other registers are 
equally worth of protection (for example, the stack pointer).

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

Reply via email to