[PATCH] Handle mtsprg and mfsprg properly for BookE
Jeff Baker
jbaker@qnx.com
Wed Mar 16 16:39:00 GMT 2005
The IBM PPC440 doesn't support reading from the supervisory SPR's (you
get garbage values back) - the mfsprg's won't be too useful. E.g.:
running the following code (MSR.PR=0) (PVR=0x41020481):
li %r7,-1
li %r8,-1
li %r6,1
mtspr 276,%r6
mfspr %r7,260
mfspr %r8,276
leaves R7 with a 1 and R8 with a 0.
This is correct behaviour according to IBM.
Alan Modra wrote:
> On Sun, Mar 13, 2005 at 03:34:33PM -0800, Alex Rosenberg wrote:
>
>>On Mar 9, 2005, at 7:58 PM, Alan Modra wrote:
>>
>>>There remains the question of which spr number should be used by
>>>privileged programs for read access to sprg4 through sprg7. Does the
>>>non-privileged spr number work when privileged? I would think it
>>>probably does, but I'm just guessing..
>>
>>I think the documentation is the problem here.
>>
>>Originally, the user mode read-only SPRG were supposed to be referred
>>to as USPRG.
>
>
> Makes sense. Consistent with the spr numbering for USPRG0 too.
>
> I propose that gas adopt this syntax. ie.
>
> mtsprg and mtsprg[0-7] writes spr272..279 (as we currently do)
> mfsprg and mfsprg[0-7] read the same regs as mtsprg
> mfusprg0 reads spr256 (as we currently do)
> Add new mfusprg[3-7] insns which read spr259..263
> Add a new mfusprg insn which reads spr256..263
>
More information about the Binutils
mailing list