1 Star 0 Fork 17

万里数据库/openeuler-greatsql

forked from src-openEuler/greatsql 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-greatsql-8.0.32-add-loongarch-support.patch 3.30 KB
一键复制 编辑 原始数据 按行查看 历史
zhangwenlong01 提交于 2024-06-07 10:04 . add loongarch64 support
From 77b6310acfd57e500211784806bb60c76c9a6cb2 Mon Sep 17 00:00:00 2001
From: Huang Yang <huangyang@loongson.cn>
Date: Mon, 22 Apr 2024 03:23:18 +0000
Subject: [PATCH] greatsql 8.0.32 add loongarch support
---
extra/duktape/duktape-2.7.0/src/duk_config.h | 12 ++++++++++
.../source/i18n/double-conversion-utils.h | 3 ++-
storage/ndb/include/portlib/mt-asm.h | 24 +++++++++++++++++++
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/extra/duktape/duktape-2.7.0/src/duk_config.h b/extra/duktape/duktape-2.7.0/src/duk_config.h
index 77cddc1d..2c919ea9 100644
--- a/extra/duktape/duktape-2.7.0/src/duk_config.h
+++ b/extra/duktape/duktape-2.7.0/src/duk_config.h
@@ -42,6 +42,7 @@
* - SPARC 64-bit
* - RISC-V 32-bit
* - RISC-V 64-bit
+ * - loongarch 64-bit
* - SuperH
* - Motorola 68k
* - Emscripten
@@ -303,6 +304,11 @@
#endif
#endif /* __riscv */
+/* loongarch64 */
+#if defined(__loongarch64)
+#define DUK_F_LOONGARCH64
+#endif
+
/* SuperH */
#if defined(__sh__) || \
defined(__sh1__) || defined(__SH1__) || \
@@ -991,6 +997,12 @@
#define DUK_USE_BYTEORDER 1
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
+#elif defined(DUK_F_LOONGARCH64)
+/* --- loongarch 64-bit --- */
+#define DUK_USE_ARCH_STRING "loongarch64"
+#define DUK_USE_BYTEORDER 1
+#undef DUK_USE_PACKED_TVAL
+#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SUPERH)
/* --- SuperH --- */
#define DUK_USE_ARCH_STRING "sh"
diff --git a/extra/icu/icu-release-69-1/source/i18n/double-conversion-utils.h b/extra/icu/icu-release-69-1/source/i18n/double-conversion-utils.h
index c9374636..8d95fe89 100644
--- a/extra/icu/icu-release-69-1/source/i18n/double-conversion-utils.h
+++ b/extra/icu/icu-release-69-1/source/i18n/double-conversion-utils.h
@@ -128,7 +128,8 @@ int main(int argc, char** argv) {
defined(__riscv) || defined(__e2k__) || \
defined(__or1k__) || defined(__arc__) || \
defined(__microblaze__) || defined(__XTENSA__) || \
- defined(__EMSCRIPTEN__) || defined(__wasm32__)
+ defined(__EMSCRIPTEN__) || defined(__wasm32__) || \
+ defined(__loongarch64)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(__mc68000__) || \
defined(__pnacl__) || defined(__native_client__)
diff --git a/storage/ndb/include/portlib/mt-asm.h b/storage/ndb/include/portlib/mt-asm.h
index 418b8d9c..f2518eeb 100644
--- a/storage/ndb/include/portlib/mt-asm.h
+++ b/storage/ndb/include/portlib/mt-asm.h
@@ -156,6 +156,30 @@ xcng(volatile unsigned * addr, int val)
#define wmb() std::atomic_thread_fence(std::memory_order_seq_cst)
#define cpu_pause() __asm__ __volatile__ ("yield")
+#elif defined(__loongarch64)
+
+#define NDB_HAVE_MB
+#define NDB_HAVE_RMB
+#define NDB_HAVE_WMB
+//#define NDB_HAVE_XCNG
+
+// details frome kernel-6.9 arch/loongarch/include/asm/barrier.h
+
+#define DBAR(hint) __asm__ __volatile__("dbar %0 " : : "I"(hint) : "memory")
+
+#define crwrw 0b00000
+#define cr_r_ 0b00101
+#define c_w_w 0b01010
+
+#define c_sync() DBAR(crwrw)
+#define c_rsync() DBAR(cr_r_)
+#define c_wsync() DBAR(c_w_w)
+
+#define mb() c_sync()
+#define rmb() c_rsync()
+#define wmb() c_wsync()
+
+#define cpu_pause() __asm__ __volatile__ ("nop")
#else
#define NDB_NO_ASM "Unsupported architecture (gcc)"
--
2.43.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/GreatSQL/openeuler-greatsql.git
git@gitee.com:GreatSQL/openeuler-greatsql.git
GreatSQL
openeuler-greatsql
openeuler-greatsql
master

搜索帮助