linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: ps3 64-bit kernel: patched prpmc2800.c (fwd)
@ 2007-05-25  6:39 Maik Nijhuis
  2007-06-02 18:39 ` Geoff Levand
  2007-06-03  1:51 ` Paul Mackerras
  0 siblings, 2 replies; 5+ messages in thread
From: Maik Nijhuis @ 2007-05-25  6:39 UTC (permalink / raw)
  To: linuxppc-dev

I had an earlier discussion with Geoff Levand, he suggested me to post it
here.

While compiling a 64-bit kernel for the playstation 3 I noticed that
arch/powerpc/boot/prpmc2800.c doesn't compile. The assembler complains
about a constant that is too big.

When I compile prpmc2800.c this is what 'make V=1' shows:

gcc -m32 -Wp,-MD,arch/powerpc/boot/.prpmc2800.o.d -Wall
-Wstrict-prototypes -O2 -fomit-frame-pointer -fno-builtin -nostdinc
-isystem /usr/lib/gcc/powerpc64-unknown-linux-gnu/4.1.2/include -fPIC
-fno-stack-protector -Iarch/powerpc/boot
-I/usr/src/ps3-linux/arch/powerpc/boot -c -o arch/powerpc/boot/prpmc2800.o
arch/powerpc/boot/prpmc2800.c

And then this error follows:

/tmp/ccYHAOD7.s: Assembler messages:
/tmp/ccYHAOD7.s:9: Error: operand out of range (0xffffffffffff7fff is not
between 0x0000000000000000 and 0x00000000ffffffff)

I managed to fix this issue as follows: At the end of
arch/powerpc/boot/prpmc2800.c, there is an assembly instruction

rlwinm  10,10,0,~(1<<15)

I replaced this by

rlwinm  10,10,0,~(1<<15) & ((1<<32)-1)

I am running 64-bit gentoo linux with binutils 2.17.50.0.16. It has been
compiled on my ps3 using gentoo ebuild scripts.

After downgrading to binutils 2.17 the problem is gone..

In the binutils bugzilla I couldn't find anything when I searched for
'operand out of range'. It seems like an assembler bug: A 64-bit value is
assumed in a 32 bit instruction, even though the assembler runs in 32 bit
mode because of the -m32. As the value is used in an 'and', the high bits
can safely be ignored.

Could you please either fix binutils or apply the above patch?

Maik

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

* Re: ps3 64-bit kernel: patched prpmc2800.c (fwd)
  2007-05-25  6:39 ps3 64-bit kernel: patched prpmc2800.c (fwd) Maik Nijhuis
@ 2007-06-02 18:39 ` Geoff Levand
  2007-06-03  1:51 ` Paul Mackerras
  1 sibling, 0 replies; 5+ messages in thread
From: Geoff Levand @ 2007-06-02 18:39 UTC (permalink / raw)
  To: Maik Nijhuis; +Cc: linuxppc-dev

Maik Nijhuis wrote:
> While compiling a 64-bit kernel for the playstation 3 I noticed that
> arch/powerpc/boot/prpmc2800.c doesn't compile. The assembler complains
> about a constant that is too big.
> 
> And then this error follows:
> 
> /tmp/ccYHAOD7.s: Assembler messages:
> /tmp/ccYHAOD7.s:9: Error: operand out of range (0xffffffffffff7fff is not
> between 0x0000000000000000 and 0x00000000ffffffff)
> 
> I managed to fix this issue as follows: At the end of
> arch/powerpc/boot/prpmc2800.c, there is an assembly instruction
> 
> rlwinm  10,10,0,~(1<<15)
> 
> I replaced this by
> 
> rlwinm  10,10,0,~(1<<15) & ((1<<32)-1)
> 
> I am running 64-bit gentoo linux with binutils 2.17.50.0.16. It has been
> compiled on my ps3 using gentoo ebuild scripts.
> 
> Could you please either fix binutils or apply the above patch?

The trouble is that I have no way to test that change.  I don't have the
hardware.  Since that file is not for PS3, the best thing to do
is to not build that file when not building for prpmc2800.  I will
post a patch that does that.

-Geoff

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

* Re: ps3 64-bit kernel: patched prpmc2800.c (fwd)
  2007-05-25  6:39 ps3 64-bit kernel: patched prpmc2800.c (fwd) Maik Nijhuis
  2007-06-02 18:39 ` Geoff Levand
@ 2007-06-03  1:51 ` Paul Mackerras
  2007-06-03 23:25   ` Mark A. Greer
  1 sibling, 1 reply; 5+ messages in thread
From: Paul Mackerras @ 2007-06-03  1:51 UTC (permalink / raw)
  To: Maik Nijhuis; +Cc: linuxppc-dev

Maik Nijhuis writes:

> I managed to fix this issue as follows: At the end of
> arch/powerpc/boot/prpmc2800.c, there is an assembly instruction
> 
> rlwinm  10,10,0,~(1<<15)
> 
> I replaced this by
> 
> rlwinm  10,10,0,~(1<<15) & ((1<<32)-1)

It is a binutils bug, and Alan Modra has a patch for it.  In the
meantime the best thing would be to change that to

	rlwinm	10,10,0,17,15

which is equivalent.

Paul.

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

* Re: ps3 64-bit kernel: patched prpmc2800.c (fwd)
  2007-06-03  1:51 ` Paul Mackerras
@ 2007-06-03 23:25   ` Mark A. Greer
  2007-06-04  8:14     ` Segher Boessenkool
  0 siblings, 1 reply; 5+ messages in thread
From: Mark A. Greer @ 2007-06-03 23:25 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, Maik Nijhuis

On Sun, Jun 03, 2007 at 11:51:56AM +1000, Paul Mackerras wrote:
> Maik Nijhuis writes:
> 
> > I managed to fix this issue as follows: At the end of
> > arch/powerpc/boot/prpmc2800.c, there is an assembly instruction
> > 
> > rlwinm  10,10,0,~(1<<15)
> > 
> > I replaced this by
> > 
> > rlwinm  10,10,0,~(1<<15) & ((1<<32)-1)
> 
> It is a binutils bug, and Alan Modra has a patch for it.  In the
> meantime the best thing would be to change that to
> 
> 	rlwinm	10,10,0,17,15
> 
> which is equivalent.

Oops, I totally missed this thread.  I'll whip up a patch for this on Monday.

Mark

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

* Re: ps3 64-bit kernel: patched prpmc2800.c (fwd)
  2007-06-03 23:25   ` Mark A. Greer
@ 2007-06-04  8:14     ` Segher Boessenkool
  0 siblings, 0 replies; 5+ messages in thread
From: Segher Boessenkool @ 2007-06-04  8:14 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev, Maik Nijhuis, Paul Mackerras

>> It is a binutils bug, and Alan Modra has a patch for it.  In the
>> meantime the best thing would be to change that to
>>
>> 	rlwinm	10,10,0,17,15
>>
>> which is equivalent.
>
> Oops, I totally missed this thread.  I'll whip up a patch for this on 
> Monday.

Unless I'm mistaken, this bug doesn't exist in any released
version of binutils, so no kernel patch should be necessary
(people using a development version of binutils should just
upgrade to the latest, which has this fixed already).


Segher

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

end of thread, other threads:[~2007-06-04  8:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-25  6:39 ps3 64-bit kernel: patched prpmc2800.c (fwd) Maik Nijhuis
2007-06-02 18:39 ` Geoff Levand
2007-06-03  1:51 ` Paul Mackerras
2007-06-03 23:25   ` Mark A. Greer
2007-06-04  8:14     ` Segher Boessenkool

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).