[PATCH] Handle mtsprg and mfsprg properly for BookE

Jeff Baker jbaker@qnx.com
Wed Mar 9 01:18:00 GMT 2005


The BookE Specification itself states that reading sprg3 in user mode is 
implementation defined.  The current implementation of the assembler 
bears that out as it will not output a user mode mfsprg3 under any 
circumstances.

The specifications for the e500 (PPC_OPCODE_SPE) and MPC8560 (I'm not 
sure how to test for this specifically) state that sprg3 is readable in 
user mode.  For PowerPC 440 (PPC_OPCODE_440) and PowerPC 405 
(PPC_OPCODE_403) it is not.

Would it be correct to change the generic PPC_OPCODE_BOOKE case to 
always use user mode sprg2+ and then override it to be sprg3+ for 
PPC_OPCODE_403 and PPC_OPCODE_440?  Should there be a version of mtsprg3 
for e500 and MPC8560 that encodes 259 instead of 275?

The function of these registers is well defined for each processor but 
I'm at your mercy for how to implement it within gas in a manner that 
you find acceptable.

Alan Modra wrote:
> On Tue, Mar 08, 2005 at 11:32:06AM -0500, Jeff Baker wrote:
> 
>>I also assumed that one reason for submitting a patch to the mailing 
>>list is so that people who know more than I do can review it and then 
>>point out where I'm making mistakes.
> 
> 
> Well, you've now had some mistakes pointed out.  Don't expect me to
> research the relevant architecture documents for you.  It's your job as
> patch submitter to do this.  Instead I saw:
> 
> "Below is my attempt at a patch to add support for"
> 
> "Below is an updated (and I believe more correct) version of this
> patch."
> 
> "The following patch may also be correct."
> 
> That doesn't exactly inspire confidence that you have done any research
> to determine what should be done about mt/mfsprg.  So I went out of my
> way to look at a BOOKE reference, and found the alternate register
> numbering.  Your patch won't be applied until you give some
> justification that the choices you've made regarding spr reg numbers are
> correct or at least most useful.
> 



More information about the Binutils mailing list