[RFC PATCH] powerpc: Fix dubious r0 usage

Michael Ellerman mpe at ellerman.id.au
Sat Feb 18 19:06:03 AEDT 2017


Alan Modra <amodra at gmail.com> writes:

> On Fri, Feb 17, 2017 at 11:08:53PM +1100, Michael Ellerman wrote:
>> Bleeding edge binutils no longer accepts r0 in places where the CPU
>> interprets the value as a literal 0.
>
> Wow!  That was quite some cleanup.  I think I'd better turn the error
> into a warning..

That would be my preference :)

If it remains a hard error we'll need to backport this patch to multiple
stable versions so that people can build those older kernels with new
binutils. Which we can do, but it's a bit of a pain.

>> --- a/arch/powerpc/purgatory/trampoline.S
>> +++ b/arch/powerpc/purgatory/trampoline.S
>> @@ -67,7 +67,7 @@ master:
>>  	mr	%r16,%r3	/* save dt address in reg16 */
>>  	li	%r4,20
>>  	LWZX_BE	%r6,%r3,%r4	/* fetch __be32 version number at byte 20 */
>> -	cmpwi	%r0,%r6,2	/* v2 or later? */
>> +	cmpwi	0,%r6,2		/* v2 or later? */
>>  	blt	1f
>>  	li	%r4,28
>>  	STWX_BE	%r17,%r3,%r4	/* Store my cpu as __be32 at byte 28 */
>
> With this one, it would probably be better to omit the zero (BF
> field).

Yeah good point, thanks for reviewing.

cheers


More information about the Linuxppc-dev mailing list