On 5/1/10, Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk wrote:
Blue Swirl wrote:
I think I can now reproduce the crash, previously I had no problems which made debugging a bit difficult. I changed gcc's memory model flag to -mcmodel=medlow and now Milax crashes in __umodti3 like Igor reported. Perhaps this flag may be different when gcc builds libgcc.
The problem seems to be that gcc's libgcc divides by zero. Breakpoint 10, __umodti3 (u=<value optimized out>, v=0x0000000000000000fffffffffffffffe)
at ../../gcc/libgcc2.c:911
911 in ../../gcc/libgcc2.c 11: $i4 = 0x0 10: $i0 = 0x1 1: x/i $pc 0xffd1f980 <__umodti3+952>: udivx %i0, %i4, %g1
Why this doesn't happen with our libgcc? Why it doesn't happen with -mcmodel=medany? What a puzzle.
One solution could be to check for division by zero in mudivmod(), which is where __umodti3 is called from.
Earlier today Segher was kind enough to send me some pointers over IRC. One of the things we did find was that the version of gcc may be relevant. My original cross-compiler was based on gcc 4.3.2 and with your attached patch causes a crash - but upgrading to gcc 4.5.0 and then rebuilding OpenBIOS with your patch creates a working runtime once again.
I also built a cross-compiler with gcc 4.5.0. It produces working binaries with current SVN HEAD. The (expected) result with SVN HEAD is that Milax loads but we get back to OpenBIOS prompt, with 'go' OpenSolaris loads but there is an error message about panic buffer. In Linux tests, SILO loads Linux kernel, which then complains about PBM-A space.
But with the libgcc removal patch applied, I get this with Milax: [sparc64] Booting file 'cdrom' with parameters '' Unhandled Exception 0x00000001ffcd2000 PC = 0x00000000ffd2296c NPC = 0x00000000ffd22970 Stopping execution
Linux tests crash before SILO. It's strange that in your tests this worked.
SVN HEAD, only removed all -mcmodel flags: Milax boots but crashes before complaining about panic buffer: Jumping to entry point 00000000010071d8 for type 0000000000000001... switching to new context: entry point 0x10071d8 stack 0x00000000ffe02a91 Unhandled Exception 0x0000000100e66000 PC = 0x00000000ffd1dc10 NPC = 0x00000000ffd1dc14 Stopping execution
The same happens with both libgcc removal and no-mcmodel patches applied. Linux boot tests crash during SILO load.
There was some discussion earlier that instead of sparc64-elf, sparc64-eabi would be a better choice. But I got this error when configuring gcc: *** Configuration sparc64-unknown-eabi not supported