On Fri, Nov 23, 2012 at 12:30 PM, Julius Baxter <[email protected]>wrote:

> I know Ruben was keen on raising exceptions for accessing
> unimplemented SPR space but I'm not a fan simply because it requires
> more implementation complexity, and it's not obvious which exception
> should be raised. Illegal instruction maybe is best? I really don't
> know why you'd go to this length to catch obvious software bugs. I
> mean, it's just going to be either an incorrectly written bit of
> assembler (easily picked up by looking in the trace and seeing the
> calculated SPR is wrong) or attempting to use a unit which is not
> present (dumping the UPR will show you that the implementation doesn't
> have the unit you're attempting to use - even better, make the code
> check the UPR before running those bits of code.)
>

I'd agree that raising an exception is not the correct choice, do to the
added circuit complexity.  The only time you'd normally access an SPR with
a non-hard-coded address is in the context switch code, where having
exceptions doesn't help.  And for that purpose, just returning zero in
mfspr and performing a nop in mtspr for unimplemented SPRs would work just
as well.

Personally, I can't think of a situation where you'd want to have a tight
loop where you'd read/write a potentially unimplemented SPR and where
having an exception would help.  Especially since 90% of the SPRs aren't
available from user code.

Make this my vote that mtspr with an unimplemented address is just a nop.

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

Reply via email to