greatsql/add-riscv64-support.patch

42 lines
1.0 KiB
Diff
Raw Permalink Normal View History

2025-05-18 21:55:54 +00:00
From: GreatSQL<greatsql@greatdb.com>
Date: Mon, 30 Sep 2024 20:32:57 +0800
Date: Thu, 06 Mar 2025 14:08:51 +0800
Subject: [PATCH] add riscv64 support
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e58d2efa2b1..c31f3c6992c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -722,6 +722,7 @@ SET(KNOWN_64BIT_ARCHITECTURES
s390x
x86_64
sw_64
+ riscv64
)
# Include the platform-specific file. To allow exceptions, this code
diff --git a/storage/ndb/include/portlib/mt-asm.h b/storage/ndb/include/portlib/mt-asm.h
index a63fae161e4..cc7ea267028 100644
--- a/storage/ndb/include/portlib/mt-asm.h
+++ b/storage/ndb/include/portlib/mt-asm.h
@@ -84,6 +84,19 @@ cpu_pause()
}
#endif
+#elif defined(__riscv)
+
+#define NDB_HAVE_MB
+#define NDB_HAVE_RMB
+#define NDB_HAVE_WMB
+
+#define RISCV_FENCE(p, s) \
+ __asm__ __volatile__ ("fence " #p "," #s : : : "memory")
+
+#define mb() RISCV_FENCE(iorw,iorw)
+#define rmb() RISCV_FENCE(ir,ir)
+#define wmb() RISCV_FENCE(ow,ow)
+
#elif defined(__sparc__)
#define NDB_HAVE_MB