mirror of
https://abf.rosa.ru/djam/userspace-rcu.git
synced 2025-02-23 18:22:55 +00:00
194 lines
6.1 KiB
Diff
194 lines
6.1 KiB
Diff
diff --git a/include/Makefile.am b/include/Makefile.am
|
|
index 3f92cc3..68e9790 100644
|
|
--- a/include/Makefile.am
|
|
+++ b/include/Makefile.am
|
|
@@ -2,6 +2,7 @@ nobase_include_HEADERS = \
|
|
urcu/arch/aarch64.h \
|
|
urcu/arch/alpha.h \
|
|
urcu/arch/arm.h \
|
|
+ urcu/arch/e2k.h \
|
|
urcu/arch/gcc.h \
|
|
urcu/arch/generic.h \
|
|
urcu/arch.h \
|
|
@@ -62,6 +63,7 @@ nobase_include_HEADERS = \
|
|
urcu/uatomic/alpha.h \
|
|
urcu/uatomic_arch.h \
|
|
urcu/uatomic/arm.h \
|
|
+ urcu/uatomic/e2k.h \
|
|
urcu/uatomic/gcc.h \
|
|
urcu/uatomic/generic.h \
|
|
urcu/uatomic.h \
|
|
diff --git a/include/urcu/arch.h b/include/urcu/arch.h
|
|
index 620743c..6f809c7 100644
|
|
--- a/include/urcu/arch.h
|
|
+++ b/include/urcu/arch.h
|
|
@@ -64,6 +64,11 @@
|
|
#define URCU_ARCH_AMD64 1
|
|
#include <urcu/arch/x86.h>
|
|
|
|
+#elif defined(__e2k__)
|
|
+
|
|
+#define URCU_ARCH_E2K 1
|
|
+#include <urcu/arch/e2k.h>
|
|
+
|
|
#elif (defined(__i486__) || defined(__i586__) || defined(__i686__))
|
|
|
|
#define URCU_ARCH_X86 1
|
|
diff --git a/include/urcu/arch/e2k.h b/include/urcu/arch/e2k.h
|
|
new file mode 100644
|
|
index 0000000..b4d80ca
|
|
--- /dev/null
|
|
+++ b/include/urcu/arch/e2k.h
|
|
@@ -0,0 +1,86 @@
|
|
+#ifndef _URCU_ARCH_E2K_H
|
|
+#define _URCU_ARCH_E2K_H
|
|
+
|
|
+/*
|
|
+ * arch_e2k.h: trivial definitions for the e2k architecture.
|
|
+ *
|
|
+ * This library is free software; you can redistribute it and/or
|
|
+ * modify it under the terms of the GNU Lesser General Public
|
|
+ * License as published by the Free Software Foundation; either
|
|
+ * version 2.1 of the License, or (at your option) any later version.
|
|
+ *
|
|
+ * This library 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
|
|
+ * Lesser General Public License for more details.
|
|
+ *
|
|
+ * You should have received a copy of the GNU Lesser General Public
|
|
+ * License along with this library; if not, write to the Free Software
|
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
+ */
|
|
+
|
|
+#include <urcu/compiler.h>
|
|
+#include <urcu/config.h>
|
|
+
|
|
+#ifdef __cplusplus
|
|
+extern "C" {
|
|
+#endif
|
|
+
|
|
+#define E2K_GET_DSREG(reg_mnemonic) \
|
|
+({ \
|
|
+ unsigned long long __res; \
|
|
+ asm volatile ("rrd %%" #reg_mnemonic ", %0" : "=r" (__res)); \
|
|
+ __res; \
|
|
+})
|
|
+
|
|
+#define _ld_c 0x8 /* stop until all load operations complete */
|
|
+#define _st_c 0x4 /* stop until store operations complete */
|
|
+#define E2K_WAIT(num) \
|
|
+({ \
|
|
+ asm volatile ("{wait \tma_c = %0, fl_c = %1, ld_c = %2, " \
|
|
+ "st_c = %3, all_e = %4, all_c = %5}" \
|
|
+ : \
|
|
+ : "i" (((num) & 0x20) >> 5), \
|
|
+ "i" (((num) & 0x10) >> 4), \
|
|
+ "i" (((num) & 0x8) >> 3), \
|
|
+ "i" (((num) & 0x4) >> 2), \
|
|
+ "i" (((num) & 0x2) >> 1), \
|
|
+ "i" (((num) & 0x1)) \
|
|
+ : "memory" ); \
|
|
+})
|
|
+
|
|
+#define barrier() __asm__ __volatile__("{nop}" ::: "memory")
|
|
+
|
|
+#define caa_cpu_relax() __asm__ __volatile__("{nop 7}" ::: "memory")
|
|
+
|
|
+
|
|
+#define cmm_mb() E2K_WAIT(_st_c|_ld_c)
|
|
+#define cmm_wmb() E2K_WAIT(_st_c)
|
|
+#define cmm_rmb() E2K_WAIT(_ld_c)
|
|
+
|
|
+#ifdef CONFIG_RCU_SMP
|
|
+#define cmm_smp_mb() cmm_mb()
|
|
+#define cmm_smp_rmb() cmm_rmb()
|
|
+#define cmm_smp_wmb() cmm_wmb()
|
|
+#else
|
|
+#define cmm_smp_mb() barrier()
|
|
+#define cmm_smp_rmb() barrier()
|
|
+#define cmm_smp_wmb() barrier()
|
|
+#endif
|
|
+
|
|
+#define cmm_read_barrier_depends() do { } while (0)
|
|
+
|
|
+#define HAS_CAA_GET_CYCLES
|
|
+typedef unsigned long long caa_cycles_t;
|
|
+static inline caa_cycles_t caa_get_cycles(void)
|
|
+{
|
|
+ return E2K_GET_DSREG(clkr);
|
|
+}
|
|
+
|
|
+#ifdef __cplusplus
|
|
+}
|
|
+#endif
|
|
+
|
|
+#include <urcu/arch/generic.h>
|
|
+
|
|
+#endif /* _URCU_ARCH_E2K_H */
|
|
diff --git a/include/urcu/compiler.h b/include/urcu/compiler.h
|
|
index 34eb564..9974dfd 100644
|
|
--- a/include/urcu/compiler.h
|
|
+++ b/include/urcu/compiler.h
|
|
@@ -24,7 +24,11 @@
|
|
#define caa_likely(x) __builtin_expect(!!(x), 1)
|
|
#define caa_unlikely(x) __builtin_expect(!!(x), 0)
|
|
|
|
+#ifdef __e2k__
|
|
+#define cmm_barrier() __asm__ __volatile__ ("{nop}" ::: "memory")
|
|
+#else
|
|
#define cmm_barrier() __asm__ __volatile__ ("" : : : "memory")
|
|
+#endif
|
|
|
|
/*
|
|
* Instruct the compiler to perform only a single access to a variable
|
|
diff --git a/include/urcu/uatomic.h b/include/urcu/uatomic.h
|
|
index 2fb5fd4..4497e40 100644
|
|
--- a/include/urcu/uatomic.h
|
|
+++ b/include/urcu/uatomic.h
|
|
@@ -25,6 +25,8 @@
|
|
|
|
#if defined(URCU_ARCH_X86)
|
|
#include <urcu/uatomic/x86.h>
|
|
+#elif defined(URCU_ARCH_E2K)
|
|
+#include <urcu/uatomic/e2k.h>
|
|
#elif defined(URCU_ARCH_PPC)
|
|
#include <urcu/uatomic/ppc.h>
|
|
#elif defined(URCU_ARCH_S390)
|
|
diff --git a/include/urcu/uatomic/e2k.h b/include/urcu/uatomic/e2k.h
|
|
new file mode 100644
|
|
index 0000000..4792268
|
|
--- /dev/null
|
|
+++ b/include/urcu/uatomic/e2k.h
|
|
@@ -0,0 +1,31 @@
|
|
+ #ifndef _URCU_UATOMIC_ARCH_E2K_H
|
|
+#define _URCU_UATOMIC_ARCH_E2K_H
|
|
+
|
|
+/*
|
|
+ * Atomic exchange operations for the e2k architecture. Let GCC do it.
|
|
+ *
|
|
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
+ * of this software and associated documentation files (the "Software"), to
|
|
+ * deal in the Software without restriction, including without limitation the
|
|
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
+ * sell copies of the Software, and to permit persons to whom the Software is
|
|
+ * furnished to do so, subject to the following conditions:
|
|
+ *
|
|
+ * The above copyright notice and this permission notice shall be included in
|
|
+ * all copies or substantial portions of the Software.
|
|
+ *
|
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
+ * IN THE SOFTWARE.
|
|
+ */
|
|
+
|
|
+#include <urcu/compiler.h>
|
|
+#include <urcu/system.h>
|
|
+#include <urcu/uatomic/generic.h>
|
|
+
|
|
+#endif /* _URCU_UATOMIC_ARCH_E2K_H */
|
|
+
|