Port-powerpc archive

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

Re: DSI traps in init caused by new ld.elf_so



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Mar 3, 2011, at 3:08 PM, Frank Wille wrote:

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

... and I built my last few macppc userlands on an US-IIIi box, so that's why this particular bug didn't bite me.

have fun
Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQEUAwUBTXBat8pnzkX8Yg2nAQLpgAf3fKRUomp//ZopJoesOJ8sG9mcZ+Rm9MA+
LY9T12kOKGOibxtn1W3zdxeVBa3dsiRLNA8/kpGClWDEHyXztVYgCV9O7u8LvWYR
z4skwhRfzdZwlURSrXj2HwiBnBXg89knoGy9ceyNAhl5nz0TrfMEF/Pli1G0wlqY
oAD6hnFiw/F6IS8bVvQ9dFS4U0/+HA0BEQuPurfrAwJqEpt2gwJKqeeWcEvyek7g
0Y+yTXmIN7rPrg25++iWiVIuZbo6KBHjO2aS39Q5M2dTUiDpeEDk74wZjhRnTrb9
gZsCqIw/puggi0J7n+Gjyb//SLekABrjTyG+n8D1QFNjD8QGKF5G
=uoNW
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index