[Mono-dev] [PATCH] Fix Sparc/Linux build.
Zoltan Varga
vargaz at gmail.com
Fri Mar 5 09:24:01 EST 2010
Hi,
Applied to SVN HEAD/2.6 branch.
thanks
Zoltan
On Thu, Mar 4, 2010 at 12:14 PM, David Miller <davem at davemloft.net> wrote:
>
> This was the minimal set of changes I needed to get mainline
> to build for me.
>
> libgc/
>
> 2010-03-04 David S. Miller <davem at davemloft.net>
>
> * include/private/gc_locks.h: Add SPARC implementations of
> GC_compare_and_exchange and GC_memory_barrier.
>
> mono/mini/
>
> 2010-03-04 David S. Miller <davem at davemloft.net>
>
> * mini-sparc.h: Always use MONO_ARCH_USE_SIGACTION. Linux kernels
> that don't provide the siginfo in the second signal handler argument
> are buggy, and this has been fixed for years.
> * mini.h (GET_CONTEXT): Remove __sparc__ special case.
> (SIG_HANDLER_SIGNATURE, SIG_HANDLER_PARMS): Likewise.
>
> diff --git a/libgc/include/private/gc_locks.h
> b/libgc/include/private/gc_locks.h
> index 23a506a..1cbcbd6 100644
> --- a/libgc/include/private/gc_locks.h
> +++ b/libgc/include/private/gc_locks.h
> @@ -500,6 +500,51 @@
> }
> # endif /* POWERPC */
>
> +# if defined(SPARC)
> +# if !defined(GENERIC_COMPARE_AND_SWAP)
> +# if CPP_WORDSZ == 64
> + /* Returns TRUE if the comparison succeeded. */
> + inline static GC_bool GC_compare_and_exchange(volatile GC_word
> *addr,
> + GC_word old, GC_word new_val)
> + {
> + unsigned long result;
> + __asm__ __volatile__(
> + "casx [%2], %3, %0"
> + : "=r" (result)
> + : "0" (new_val), "r" (addr), "r" (old)
> + : "memory");
> + return (GC_bool) (result == old);
> + }
> +# else
> + /* Returns TRUE if the comparison succeeded. */
> + inline static GC_bool GC_compare_and_exchange(volatile GC_word
> *_addr,
> + GC_word _old, GC_word _new_val)
> + {
> + register unsigned long result asm("o0");
> + register unsigned long old asm("o1");
> + register volatile GC_word *addr asm("o2");
> + result = _new_val;
> + old = _old;
> + addr = _addr;
> + __asm__ __volatile__(
> + /* We encode the instruction directly so that it
> + doesn't taint the whole binary as v9-only. */
> + ".word 0xd1e29009" /* cas [%o2], %o1, %o0 */
> + : "=r" (result)
> + : "0" (result), "r" (addr), "r"(old)
> + : "memory");
> + return (GC_bool) (result == old);
> + }
> +# endif
> +# endif /* !GENERIC_COMPARE_AND_SWAP */
> + inline static void GC_memory_barrier()
> + {
> + /* All sparc v9 chips provice procesor consistent ordering. */
> + /* Thus a compiler barrier should suffice. */
> + __asm__ __volatile__("" : : : "memory");
> + }
> +# endif /* SPARC */
> +
> # if defined(IA64)
> # if !defined(GENERIC_COMPARE_AND_SWAP)
> inline static GC_bool GC_compare_and_exchange(volatile GC_word
> *addr,
> diff --git a/mono/mini/mini-sparc.h b/mono/mini/mini-sparc.h
> index 5cc2ec4..3f3eefd 100644
> --- a/mono/mini/mini-sparc.h
> +++ b/mono/mini/mini-sparc.h
> @@ -100,14 +100,7 @@ typedef struct MonoCompileArch {
> MONO_CONTEXT_SET_SP ((ctx), __builtin_frame_address (0));
> \
> } while (0)
>
> -#ifndef __linux__
> -/*
> - * Can't use sigaction on sparc/linux, since it doesn't support
> SA_SIGINFO. Instead, we
> - * have to use the obsolete sigcontext parameter:
> - * http://www.ussg.iu.edu/hypermail/linux/kernel/0110.3/1531.html.
> - */
> #define MONO_ARCH_USE_SIGACTION 1
> -#endif
>
> #ifdef HAVE_WORKING_SIGALTSTACK
> /*#define MONO_ARCH_SIGSEGV_ON_ALTSTACK*/
> diff --git a/mono/mini/mini.h b/mono/mini/mini.h
> index 2410f7b..17432be 100644
> --- a/mono/mini/mini.h
> +++ b/mono/mini/mini.h
> @@ -2061,9 +2061,6 @@ gboolean mono_gdb_render_native_backtraces (void)
> MONO_INTERNAL;
> #ifdef MONO_ARCH_USE_SIGACTION
> #define GET_CONTEXT \
> void *ctx = context;
> -#elif defined(__sparc__)
> -#define GET_CONTEXT \
> - void *ctx = sigctx;
> #else
> #define GET_CONTEXT \
> void **_p = (void **)&_dummy; \
> @@ -2078,9 +2075,6 @@ gboolean mono_gdb_render_native_backtraces (void)
> MONO_INTERNAL;
> #elif defined(HOST_WIN32)
> #define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, EXCEPTION_RECORD
> *info, void *context)
> #define SIG_HANDLER_PARAMS _dummy, info, context
> -#elif defined(__sparc__)
> -#define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, void *sigctx)
> -#define SIG_HANDLER_PARAMS _dummy, sigctx
> #else
> #define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy)
> #define SIG_HANDLER_PARAMS _dummy
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100305/f697b1e1/attachment-0001.html
More information about the Mono-devel-list
mailing list