Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: powerpc64 ldstm.S



On Sun, 8 Mar 2009, Havard Eidnes wrote:

> while building the necessary bits to make the new bfd.h file for
> binutils, I stumbled over this problem while building libc for
> macppc64:
> 
>     compile  libc/__setjmp14.o
> /var/tmp//cc903vFQ.s: Assembler messages:
> /var/tmp//cc903vFQ.s:1450: Can't open ldstm.S for reading: No such file or 
> directory
> /u/build/HEAD/src/lib/libc/arch/powerpc64/gen/__setjmp14.S:35: Error: 
> Unrecognized opcode: `stmd'
> /u/build/HEAD/src/lib/libc/arch/powerpc64/gen/__setjmp14.S:40: Error: 
> Unrecognized opcode: `lmd'

Looking through the PPC instruction set manuals indicates that it only has 
lmw (load multiple 32-bit word) and stmw (store multiple 32-bit word) 
instructions and no equivalents for 64-bit words, so the `stmd' and `lmd' 
instructions just don't exist.  Instead you need to issue individual 
load/store instructions.

> 
> On hints from mrg@, I commented out those two lines, and the
> build completed, at least, allowing me to flatten the binutils
> mknative bump, at least.
> 
> It appears that ldstm.S is supposed to contain an assembler
> macro(?) for doing "load and store multiple":
> 
> Index: gen/__setjmp14.S
> ===================================================================
> RCS file: /cvsroot/src/lib/libc/arch/powerpc64/gen/__setjmp14.S,v
> retrieving revision 1.1
> diff -u -p -r1.1 __setjmp14.S
> --- gen/__setjmp14.S    7 Jul 2006 21:07:35 -0000       1.1
> +++ gen/__setjmp14.S    8 Mar 2009 12:55:21 -0000
> @@ -32,12 +32,12 @@ ENTRY(__setjmp14)
>         mfcr    %r12
>         mr      %r10,%r1
>         mr      %r9,%r2
> -       stmd    8, 8(%r6)               # save r8-r31
> +#      stmd    8, 8(%r6)               # save r8-r31

Use:

        std     %r8,8(%r6)
        std     %r9,16(%r6)
        std     %r10,24(%r6)
        std     %r11,32(%r6)
        std     %r12,40(%r6)
        std     %r13,48(%r6)
        std     %r14,56(%r6)
        std     %r15,64(%r6)
        std     %r16,72(%r6)
        std     %r17,80(%r6)
        std     %r18,88(%r6)
        std     %r19,96(%r6)
        std     %r20,104(%r6)
        std     %r21,112(%r6)
        std     %r22,120(%r6)
        std     %r23,128(%r6)
        std     %r24,130(%r6)
        std     %r25,138(%r6)
        std     %r26,146(%r6)
        std     %r27,152(%r6)
        std     %r28,160(%r6)
        std     %r29,168(%r6)
        std     %r30,176(%r6)
        std     %r31,184(%r6)

>         li      %r3,0
>         blr
>  
>  ENTRY(__longjmp14)
> -       lmd     8, 8(%r3)               # load r8-r31
> +#      lmd     8, 8(%r3)               # load r8-r31

Use:

        ld     %r8,8(%r6)
        ld     %r9,16(%r6)
        ld     %r10,24(%r6)
        ld     %r11,32(%r6)
        ld     %r12,40(%r6)
        ld     %r13,48(%r6)
        ld     %r14,56(%r6)
        ld     %r15,64(%r6)
        ld     %r16,72(%r6)
        ld     %r17,80(%r6)
        ld     %r18,88(%r6)
        ld     %r19,96(%r6)                               
        ld     %r20,104(%r6)
        ld     %r21,112(%r6)
        ld     %r22,120(%r6)
        ld     %r23,128(%r6)
        ld     %r24,130(%r6)
        ld     %r25,138(%r6)
        ld     %r26,146(%r6)
        ld     %r27,152(%r6)
        ld     %r28,160(%r6)
        ld     %r29,168(%r6)
        ld     %r30,176(%r6)
        ld     %r31,184(%r6)


>         mr      %r6,%r4
>         mtlr    %r11
>         mtcr    %r12
> 
> However, myself, I don't know how to implement that.  Perhaps
> someone else here can help?
> 
> That's now basically the only build problem for a powerpc64 libc.

You probably should double check the offsets I calculated.

Eduardo


Home | Main Index | Thread Index | Old Index