mirror of
https://abf.rosa.ru/djam/userspace-rcu.git
synced 2025-02-24 10:42:59 +00:00
Add e2k patch
This commit is contained in:
parent
0c61f9d37c
commit
a66573b3df
2 changed files with 175 additions and 0 deletions
174
add-e2k-support.patch
Normal file
174
add-e2k-support.patch
Normal file
|
@ -0,0 +1,174 @@
|
|||
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 */
|
||||
+
|
|
@ -11,6 +11,7 @@ Group: System/Libraries
|
|||
URL: http://lttng.org/urcu
|
||||
Source0: https://github.com/urcu/userspace-rcu/archive/v%{version}.tar.gz?/%{name}-%{version}.tar.gz
|
||||
Patch0: urcu-generic-buildfix-arm-clang.patch
|
||||
Patch1: add-e2k-support.patch
|
||||
|
||||
%description
|
||||
liburcu is a LGPLv2.1 userspace RCU (read-copy-update) library. This data
|
||||
|
|
Loading…
Add table
Reference in a new issue