dotgnu-pnet-commits
[Top][All Lists]
Advanced

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

[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and to


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. 1dd06b76e354c5c90c6ee590c48f218fea016e8e
Date: Fri, 11 Sep 2009 13:41:32 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET engine, compilers and tools (pnet)".

The branch, master has been updated
       via  1dd06b76e354c5c90c6ee590c48f218fea016e8e (commit)
      from  beaedd86ea15acd63d12a7963d22fc9a61d9102e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/pnet.git/commit/?id=1dd06b76e354c5c90c6ee590c48f218fea016e8e

commit 1dd06b76e354c5c90c6ee590c48f218fea016e8e
Author: Klaus Treichel <address@hidden>
Date:   Fri Sep 11 15:41:08 2009 +0200

    Add interlocked functions for arm and gcc.

diff --git a/ChangeLog b/ChangeLog
index 91bb1b0..dbd2f29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,11 @@
        _ILExecThreadSuspendThread, _ILExecThreadAbortThread): Set and clear
        the managedSafepointFlags by using the new interlocked functions now.
 
+       * support/interlocked.h: Include the file with new interlocked
+       functions for arm.
+
+       * support/interlocked_arm.h: Add interlocked functions for arm.
+
 2009-09-10  Klaus Treichel  <address@hidden>
 
        Change internal organization of the interlocked functions.
diff --git a/support/interlocked.h b/support/interlocked.h
index b199dae..63580bc 100644
--- a/support/interlocked.h
+++ b/support/interlocked.h
@@ -120,6 +120,7 @@
 /* TODO: implement native interlocked functions for other processors */
 
 #include "interlocked_x86.h"
+#include "interlocked_arm.h"
 #include "interlocked_any.h"
 
 #endif /* _INTERLOCKED_H_ */
diff --git a/support/interlocked_arm.h b/support/interlocked_arm.h
new file mode 100644
index 0000000..c669c85
--- /dev/null
+++ b/support/interlocked_arm.h
@@ -0,0 +1,283 @@
+/*
+ * interlocked_arm.h - Implementation of interlocked functions for
+ * Arm processors.
+ *
+ * Copyright (C) 2009  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#if defined(__arm) || defined(__arm__)
+
+#if defined(__GNUC__)
+
+#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
+       defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__) || \
+       defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
+       defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7R__)
+
+/*
+ * The versions for the interlocked operations available for all arm cores
+ * version 6 and later.
+ */
+
+/*
+ * Exchange two 32 bit integers.
+ */
+static IL_INLINE ILInt32 ILInterlockedExchange(volatile ILInt32 *dest,
+                                                                               
           ILInt32 value)
+{
+       ILInt32 retval;
+       ILInt32 state;
+
+       __asm__ __volatile__
+       (
+               "1:"
+               "ldrex  %0, [%3];"
+               "strex  %1, %4, [%3];"
+               "teq            %1, #0;"
+               "bne            1b;"
+               : "=&r" (retval), "=&r" (state), "+m" (*dest)
+               : "r" (dest), "r" (value)
+               : "cc"
+       );
+       return retval;
+}
+#define IL_HAVE_INTERLOCKED_EXCHANGE 1
+
+/*
+ * Exchange pointers.
+ */
+static IL_INLINE void *ILInterlockedExchangePointers(void * volatile *dest,
+                                                                               
                         void *value)
+{
+       void *retval;
+       ILInt32 state;
+
+       __asm__ __volatile__
+       (
+               "1:"
+               "ldrex  %0, [%3];"
+               "strex  %1, %4, [%3];"
+               "teq        %1, #0;"
+               "bne        1b;"
+               : "=&r" (retval), "=&r" (state), "+m" (*dest)
+               : "r" (dest), "r" (value)
+               : "cc"
+       );
+
+       return retval;
+}
+#define IL_HAVE_INTERLOCKED_EXCHANGEPOINTERS 1
+
+/*
+ * Compare and exchange two 32bit integers.
+ */
+static IL_INLINE ILInt32 ILInterlockedCompareAndExchange(volatile ILInt32 
*dest,
+                                                                               
                                 ILInt32 value,
+                                                                               
                                 ILInt32 comparand)
+{
+       ILInt32 retval;
+       ILInt32 state;
+
+       __asm__ __volatile__
+       (
+               "1:"
+               "ldrex                  %0, [%3];"
+               "teq                    %0, %5;"
+               "strexeq        %1, %4, [%3];"
+               "teq                    %1, #0;"
+               "bne                    1b;"
+               : "=&r" (retval), "=&r" (state), "+m" (*dest)
+               : "r" (dest), "r" (value), "Jr" (comparand)
+               : "cc"
+       );
+
+       return retval;
+}
+#define IL_HAVE_INTERLOCKED_COMPAREANDEXCHANGE 1
+
+/*
+ * Compare and exchange two pointers.
+ */
+static IL_INLINE void *ILInterlockedCompareAndExchangePointers(void * volatile 
*dest,
+                                                                               
                                           void *value,
+                                                                               
                                           void *comparand)
+{
+       void *retval;
+       ILInt32 state;
+
+       __asm__ __volatile__
+       (
+               "1:"
+               "ldrex                  %0, [%3];"
+               "teq                    %0, %5;"
+               "strexeq        %1, %4, [%3];"
+               "teq                    %1, #0;"
+               "bne                    1b;"
+               : "=&r" (retval), "=&r" (state), "+m" (*dest)
+               : "r" (dest), "r" (value), "Jr" (comparand)
+               : "cc"
+       );
+
+       return retval;
+}
+#define IL_HAVE_INTERLOCKED_COMPAREANDEXCHANGEPOINTERS 1
+
+/*
+ * Add two 32 bit integer values.
+ */
+static IL_INLINE ILInt32 ILInterlockedAdd(volatile ILInt32 *dest,
+                                                                               
 ILInt32 value)
+{
+       ILInt32 retval;
+       ILInt32 state;
+
+       __asm__ __volatile__
+       (
+               "1:"
+               "ldrex          %0, [%3];"
+               "add            %0,     %0, %4;"
+               "strex  %1, %0, [%3];"
+               "teq            %1, #0;"
+               "bne            1b;"
+               : "=&r" (retval), "=&r" (state), "+m" (*dest)
+               : "r" (dest), "Jr" (value)
+               : "cc"
+       );
+
+       return retval;
+}
+#define IL_HAVE_INTERLOCKED_ADD 1
+
+/*
+ * Subtract two 32 bit integer values.
+ */
+static IL_INLINE ILInt32 ILInterlockedSub(volatile ILInt32 *dest,
+                                                                               
 ILInt32 value)
+{
+       ILInt32 retval;
+       ILInt32 state;
+
+       __asm__ __volatile__
+       (
+               "1:"
+               "ldrex          %0, [%3];"
+               "sub            %0,     %0, %4;"
+               "strex  %1, %0, [%3];"
+               "teq            %1, #0;"
+               "bne            1b;"
+               : "=&r" (retval), "=&r" (state), "+m" (*dest)
+               : "r" (dest), "Jr" (value)
+               : "cc"
+       );
+
+       return retval;
+}
+#define IL_HAVE_INTERLOCKED_SUB 1
+
+/*
+ * 32bit bitwise AND
+ */
+static IL_INLINE void ILInterlockedAnd(volatile ILUInt32 *dest, ILUInt32 value)
+{
+       ILInt32 retval;
+       ILInt32 state;
+
+       __asm__ __volatile__ 
+       (
+               "1:"
+               "ldrex          %0, [%3];"
+               "and            %0,     %0, %4;"
+               "strex  %1, %0, [%3];"
+               "teq            %1, #0;"
+               "bne            1b;"
+               : "=&r" (retval), "=&r" (state), "+m" (*dest)
+               : "r" (dest), "Jr" (value)
+               : "cc"
+       );
+}
+#define IL_HAVE_INTERLOCKED_AND 1
+
+/*
+ * 32bit bitwise OR
+ */
+static IL_INLINE void ILInterlockedOr(volatile ILUInt32 *dest, ILUInt32 value)
+{
+       ILInt32 retval;
+       ILInt32 state;
+
+       __asm__ __volatile__ 
+       (
+               "1:"
+               "ldrex          %0, [%3];"
+               "orr            %0,     %0, %4;"
+               "strex  %1, %0, [%3];"
+               "teq            %1, #0;"
+               "bne            1b;"
+               : "=&r" (retval), "=&r" (state), "+m" (*dest)
+               : "r" (dest), "Jr" (value)
+               : "cc"
+       );
+}
+#define IL_HAVE_INTERLOCKED_OR 1
+
+#else /* __ARM_ARCH__ <= 5 */
+
+/*
+ * Exchange two 32 bit integers.
+ */
+static IL_INLINE ILInt32 ILInterlockedExchange(volatile ILInt32 *dest,
+                                                                               
           ILInt32 value)
+{
+       ILInt32 retval;
+
+       __asm__ __volatile__
+       (
+               "swp %0, %2, [%3]"
+               : "=&r" (retval), "=&r" (dest)
+               : "r" (value), "1" (dest)
+               : "memory"
+       );
+
+       return retval;
+}
+#define IL_HAVE_INTERLOCKED_EXCHANGE 1
+
+/*
+ * Exchange pointers.
+ */
+static IL_INLINE void *ILInterlockedExchangePointers(void * volatile *dest,
+                                                                               
                         void *value)
+{
+       void *retval;
+
+       __asm__ __volatile__
+       (
+               "swp %0, %2, [%3]"
+               : "=&r" (retval), "=&r" (dest)
+               : "r" (value), "1" (dest)
+               : "memory"
+       );
+
+       return retval;
+}
+#define IL_HAVE_INTERLOCKED_EXCHANGEPOINTERS 1
+
+#endif /* __ARM_ARCH__ <= 5 */
+
+#endif /* defined(__GNUC__) */
+
+#endif /* defined(__arm) || defined(__arm__) */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |    5 +
 support/interlocked.h     |    1 +
 support/interlocked_arm.h |  283 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 289 insertions(+), 0 deletions(-)
 create mode 100644 support/interlocked_arm.h


hooks/post-receive
-- 
DotGNU Portable.NET engine, compilers and tools (pnet)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]