[U-Boot] [RFC] powerpc/lib: unsafe register handling in wait_ticks

Wolfgang Denk wd at denx.de
Thu Jan 24 20:27:26 CET 2013


Dear Joakim Tjernlund,

In message <OF52C94A3D.C3BD2E6F-ONC1257AFD.005BAFE0-C1257AFD.006736C5 at transmode.se> you wrote:
> 
> This adds some extra churn to the code that my patch didn't do.
> On the other hand your patch makes the function look more
> like how gcc would have done so I am fine with that.
> However, I am not sure r14 is a good fit, I cannot remember if there is
> some
> special purpose for r14. Hopefully somebody on the list knows.

This is documented in the README:

| For PowerPC, the following registers have specific use:
| 	R1:	stack pointer
| 	R2:	reserved for system use
| 	R3-R4:	parameter passing and return values
| 	R5-R10: parameter passing
| 	R13:	small data area pointer
| 	R30:	GOT pointer
| 	R31:	frame pointer
| 
| 	(U-Boot also uses R12 as internal GOT pointer. r12
| 	is a volatile register so r12 needs to be reset when
| 	going back and forth between asm and C)
| 
|     ==> U-Boot will use R2 to hold a pointer to the global data
| 

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The idea of male and female are universal constants.
	-- Kirk, "Metamorphosis", stardate 3219.8


More information about the U-Boot mailing list