[Mono-dev] GC segfault on ARM

Tomi Valkeinen tomba at bat.org
Mon Aug 22 02:57:01 EDT 2005


On Sat, 20 Aug 2005, Paolo Molaro wrote:
> On 08/18/05 Tomi Valkeinen wrote:
>> Oh, and if you are using an ARM11 based board, you may also want to fix
>> the swp-bug (http://bugzilla.ximian.com/show_bug.cgi?id=75114)
>
> Did you test that change?
> Care to research with the libc guys why they wrote it that way and if
> your change is really the right fix?

Hi,

Yes, I did test it. All compilers seem to produce correct code after the
change. The interesting part with the bug is that even if the produced
code is against ARM reference manual, it works with all the ARM9
processors I have tested, but fails with ARM11.

The code in recent libc is actually a bit different. This is from
glibc-2.3.5:

   __asm__ __volatile__("swp %0, %1, [%2]"
                        : "=r"(ret)
                        : "0"(1), "r"(spinlock));

And this is from mono's libgc:

           __asm__ __volatile__("swp %0, %1, [%2]"
                              : "=r"(oldval)
                              : "r"(1), "r"(addr)
                              : "memory");

The version in glibc produces correct code. The fix that I proposed was 
suggested in Codesourcery's forums, but I guess the libc version is just 
as fine.

  Tomi Valkeinen




More information about the Mono-devel-list mailing list