Port-powerpc archive

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

DSI traps in init caused by new ld.elf_so



Hi,

I finally found the problem which caused the DSI traps in userland binaries
since the 10th of February.

The following part of rtld_start.S:

        /*
         * Instead of division which is costly we will use multiplicative
         * inverse.  a / n = ((a * inv(n)) >> 32)  
         * where inv(n) = (0x100000000 + n - 1) / n
         */
        mr      %r0,%r11
        lis     %r11,0x10000000b/12@h   # load multiplicative inverse of 12
        ori     %r11,%r11,0x10000000b/12@l
        mulhwu  %r11,%r11,%r0           # get high half of multiplication

...is assembled as:
    2264:       7d 60 5b 78     mr      r0,r11   
    2268:       3d 60 00 00     lis     r11,0
    226c:       61 6b 00 00     ori     r11,r11,0 
    2270:       7d 6b 00 16     mulhwu  r11,r11,r0

And the following warning are shown by the assembler on a 32-bit system:

rtld_start.S:97: Warning: left operand is a bignum; integer 0 assumed
rtld_start.S:98: Warning: left operand is a bignum; integer 0 assumed 


This explains why the daily builds do work, but all of my private builds
failed with DSI-traps. The build server is a 64-bit system, and I tried it
on several PPC and x86 platforms, but all were 32-bit... :P

To fix the source I would suggest the following modification:

        mr      %r0,%r11
        lis     %r11,0x15555556@h   # load multiplicative inverse of 12
        ori     %r11,%r11,0x15555556@l
        mulhwu  %r11,%r11,%r0           # get high half of multiplication

-- 
Frank Wille



Home | Main Index | Thread Index | Old Index