Skip to contentSkip to conversation

bug in arch/ppc/boot/common/util.S: cmplwi cr0,r3,r4 ?

DISCUSSION Frank van Maarseveen 4 participants 5 messages Aug 3, 2005 – Aug 9, 2005

lore
Share & tools
lore
#0 lore raw

I think "cmplwi" expects an immediate vale as last operand around line 255 of arch/ppc/boot/common/util.S:

	addi	r4,r4,_etext@l		# r8 = &_etext
1:	dcbf	r0,r3			# Flush the data cache
	icbi	r0,r3			# Invalidate the instruction cache
	addi	r3,r3,0x10		# Increment by one cache line
	cmplwi	cr0,r3,r4		# Are we at the end yet?
	               ^^
	blt	1b			# No, keep flushing and invalidating

I guess it should have been:

cmplw cr0,r3,r4 # Are we at the end yet?

Signature · 1 line
Frank
#1 lore raw
Quoted 11 lines · Frank van Maarseveen

I think "cmplwi" expects an immediate vale as last operand around line 255 of arch/ppc/boot/common/util.S:

	addi	r4,r4,_etext@l		# r8 = &_etext
1:	dcbf	r0,r3			# Flush the data cache
	icbi	r0,r3			# Invalidate the instruction cache
	addi	r3,r3,0x10		# Increment by one cache line
	cmplwi	cr0,r3,r4		# Are we at the end yet?
	               ^^
	blt	1b			# No, keep flushing and invalidating
Quoted 3 lines

I guess it should have been:

cmplw cr0,r3,r4 # Are we at the end yet?

Yup, looks like a real bug to me, Tom ?

Ben.

#2 lore raw
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 11 lines · Frank van Maarseveen

I think "cmplwi" expects an immediate vale as last operand around line 255 of arch/ppc/boot/common/util.S:

	addi	r4,r4,_etext@l		# r8 = &_etext
1:	dcbf	r0,r3			# Flush the data cache
	icbi	r0,r3			# Invalidate the instruction cache
	addi	r3,r3,0x10		# Increment by one cache line
	cmplwi	cr0,r3,r4		# Are we at the end yet?
	               ^^
	blt	1b			# No, keep flushing and invalidating
Quoted 5 lines
Quoted 3 lines

I guess it should have been:

cmplw cr0,r3,r4 # Are we at the end yet?

Yup, looks like a real bug to me, Tom ?

Sounds correct to me. I wonder why the assembler hasn't barfed, or is is translating the ascii values of r4. I'll pass this along once 2.6.14 opens just because the code has been that way for so many years, I don't think it's a critical bug.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#3 lore raw
Quoted 13 lines · Tom Rini
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 11 lines · Frank van Maarseveen

I think "cmplwi" expects an immediate vale as last operand around line 255 of arch/ppc/boot/common/util.S:

	addi	r4,r4,_etext@l		# r8 = &_etext
1:	dcbf	r0,r3			# Flush the data cache
	icbi	r0,r3			# Invalidate the instruction cache
	addi	r3,r3,0x10		# Increment by one cache line
	cmplwi	cr0,r3,r4		# Are we at the end yet?
	               ^^
	blt	1b			# No, keep flushing and invalidating
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I guess it should have been:

cmplw cr0,r3,r4 # Are we at the end yet?

Yup, looks like a real bug to me, Tom ?

Sounds correct to me. I wonder why the assembler hasn't barfed, or is is translating the ascii values of r4.

include/asm-ppc/ppc_asm.h:
#define r4 4

Unfortunately -mregnames is quite stupid, so that wouldn't have helped us here either.

-Hollis

#4 lore raw
In reply to Tom Rini
Quoted 15 lines · Tom Rini
Quoted 14 lines · Benjamin Herrenschmidt
Quoted 13 lines · Frank van Maarseveen

I think "cmplwi" expects an immediate vale as last operand around line 255 of arch/ppc/boot/common/util.S:

	addi	r4,r4,_etext@l		# r8 = &_etext
1:	dcbf	r0,r3			# Flush the data cache
	icbi	r0,r3			# Invalidate the instruction cache
	addi	r3,r3,0x10		# Increment by one cache line
	cmplwi	cr0,r3,r4		# Are we at the end yet?
	               ^^
	blt	1b			# No, keep flushing and invalidating

I guess it should have been:

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

cmplw cr0,r3,r4 # Are we at the end yet?

Yup, looks like a real bug to me, Tom ?

Sounds correct to me. I wonder why the assembler hasn't barfed, or is is translating the ascii values of r4. I'll pass this along once 2.6.14 opens just because the code has been that way for so many years, I don't think it's a critical bug.

Because our assembler has no clue what r4 is :) Look at our ppc_asm.h and you'll understand :)

Ben.