linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* bug in arch/ppc/boot/common/util.S: cmplwi  cr0,r3,r4 ?
@ 2005-08-03 13:18 Frank van Maarseveen
  2005-08-04  9:44 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Frank van Maarseveen @ 2005-08-03 13:18 UTC (permalink / raw)
  To: linuxppc-dev


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?

-- 
Frank

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug in arch/ppc/boot/common/util.S: cmplwi  cr0,r3,r4 ?
  2005-08-03 13:18 bug in arch/ppc/boot/common/util.S: cmplwi cr0,r3,r4 ? Frank van Maarseveen
@ 2005-08-04  9:44 ` Benjamin Herrenschmidt
  2005-08-09  0:50   ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2005-08-04  9:44 UTC (permalink / raw)
  To: Frank van Maarseveen; +Cc: linuxppc-dev

On Wed, 2005-08-03 at 15:18 +0200, Frank van Maarseveen wrote:
> 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?

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

Ben.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug in arch/ppc/boot/common/util.S: cmplwi  cr0,r3,r4 ?
  2005-08-04  9:44 ` Benjamin Herrenschmidt
@ 2005-08-09  0:50   ` Tom Rini
  2005-08-09  2:20     ` Hollis Blanchard
  2005-08-09  8:33     ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Rini @ 2005-08-09  0:50 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

On Thu, Aug 04, 2005 at 11:44:08AM +0200, Benjamin Herrenschmidt wrote:
> On Wed, 2005-08-03 at 15:18 +0200, Frank van Maarseveen wrote:
> > 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?
> 
> 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.

-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug in arch/ppc/boot/common/util.S: cmplwi  cr0,r3,r4 ?
  2005-08-09  0:50   ` Tom Rini
@ 2005-08-09  2:20     ` Hollis Blanchard
  2005-08-09  8:33     ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 5+ messages in thread
From: Hollis Blanchard @ 2005-08-09  2:20 UTC (permalink / raw)
  To: Tom Rini; +Cc: Linux PPC Dev

On Aug 8, 2005, at 7:50 PM, Tom Rini wrote:

> On Thu, Aug 04, 2005 at 11:44:08AM +0200, Benjamin Herrenschmidt wrote:
>> On Wed, 2005-08-03 at 15:18 +0200, Frank van Maarseveen wrote:
>>> 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?
>>
>> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug in arch/ppc/boot/common/util.S: cmplwi  cr0,r3,r4 ?
  2005-08-09  0:50   ` Tom Rini
  2005-08-09  2:20     ` Hollis Blanchard
@ 2005-08-09  8:33     ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2005-08-09  8:33 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-dev

On Mon, 2005-08-08 at 17:50 -0700, Tom Rini wrote:
> On Thu, Aug 04, 2005 at 11:44:08AM +0200, Benjamin Herrenschmidt wrote:
> > On Wed, 2005-08-03 at 15:18 +0200, Frank van Maarseveen wrote:
> > > 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?
> > 
> > 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-09  8:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-03 13:18 bug in arch/ppc/boot/common/util.S: cmplwi cr0,r3,r4 ? Frank van Maarseveen
2005-08-04  9:44 ` Benjamin Herrenschmidt
2005-08-09  0:50   ` Tom Rini
2005-08-09  2:20     ` Hollis Blanchard
2005-08-09  8:33     ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).