On Sun, Mar 25, 2012 at 6:23 PM, Olof Kindgren <[email protected]> wrote:
>
>
> 2012/3/25 R. Diez <[email protected]>
>>
>>
>>
>> > I'd like to throw one more suggestion into this discussion:  add a
>> > register to indicate whether r0 is writable or hard-wired to 0.  If it's
>> > not writable, it's a waste to clear it at every syscall and this can be
>> > optimized out; if it is writable, then you can use it for clever
>> > optimizations (carefully).
>>
>> I don't think the extra complication is worth it. At the very minimum,
>> that would be another special case to test.
>>
>> I would just let R0 be like any other register, and move its usage as a
>> constant zero to the ABI spec.

I agree, as this makes RTL implementation simpler and allows use cases
along the lines of what Jonas has mentioned.

Regarding whether it's detectable via a bit in an SPR or something, I
would say maybe this is something we should look at, but would first
suggest that perhaps we state in the architecture manual that writing
to the r0, even on implementations with read-only-R0, should never
cause any hardware exceptions. This should then allow for a simple
test of writing a value to GPR0 and reading it back to see if the
write worked.

Ultimately, though, it appears to me that the software clearing of
gpr0 at the beginning will be the safest thing to do, and the use of
gpr0 after that is clear if one is conforming to the ABI spec in the
arch manual.

I can propose amendments to the arch spec if this sounds good.

>>
>> Cheers,
>>   Ruben
>> _______________________________________________
>> OpenRISC mailing list
>> [email protected]
>> http://lists.openrisc.net/listinfo/openrisc
>
>
> I'm still of the opinion that we should hardwire it to zero. I know that it
> will theoretically break backwards compatibility, but I would like to know
> if this really is an issue. The benefits of hardwiring is that it will
> behave like everyone (or at least I) assumed it was implemented before this
> discussion, and I guess we don't suffer from register starvation anyways, so
> that won't be a problem. We also don't have to take care about saving and
> restoring it.

But I like saying that the implementation can do it either way - it
makes things simpler.

For any tricks relating to storing stuff in GPR0, that will be up to
the custom software to take care of. I'd say for all  ports of
libraries and software we do, we adhere to the ABI which says it's
assumed zero (and thus don't save and restore its value when exception
handling.)

Cheers

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

Reply via email to