1 Star 0 Fork 55

lyn/mysql

forked from src-openEuler/mysql 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mysql-s390-tsc.patch 1.70 KB
一键复制 编辑 原始数据 按行查看 历史
starlet_dx 提交于 2021-10-29 16:15 . Upgrade mysql to 8.0.27 for fix CVES
Support s390/s390x in performance schema's cycle-counting functions.
Filed upstream at http://bugs.mysql.com/bug.php?id=59953
---
include/my_rdtsc.h | 1 +
mysys/my_rdtsc.cc | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h
index b411eda0..03fc9a58 100644
--- a/include/my_rdtsc.h
+++ b/include/my_rdtsc.h
@@ -128,5 +128,6 @@ void my_timer_init(MY_TIMER_INFO *mti);
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
/* #define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27 - No longer used */
#define MY_TIMER_ROUTINE_ASM_AARCH64 28
+#define MY_TIMER_ROUTINE_ASM_S390 29
#endif
diff --git a/mysys/my_rdtsc.cc b/mysys/my_rdtsc.cc
index d9756487..817aa9d6 100644
--- a/mysys/my_rdtsc.cc
+++ b/mysys/my_rdtsc.cc
@@ -168,6 +168,13 @@ ulonglong my_timer_cycles(void) {
__asm __volatile__("mrs %[rt],cntvct_el0" : [ rt ] "=r"(result));
return result;
}
+#elif defined(__GNUC__) && defined(__s390__)
+ /* covers both s390 and s390x */
+ {
+ ulonglong result;
+ __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc");
+ return result;
+ }
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
/* gethrtime may appear as either cycle or nanosecond counter */
return (ulonglong)gethrtime();
@@ -453,6 +460,8 @@ void my_timer_init(MY_TIMER_INFO *mti) {
mti->cycles.routine = MY_TIMER_ROUTINE_ASM_GCC_SPARC64;
#elif defined(__GNUC__) && defined(__aarch64__)
mti->cycles.routine = MY_TIMER_ROUTINE_ASM_AARCH64;
+#elif defined(__GNUC__) && defined(__s390__)
+ mti->cycles.routine = MY_TIMER_ROUTINE_ASM_S390;
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
mti->cycles.routine = MY_TIMER_ROUTINE_GETHRTIME;
#else
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lyn1001/mysql.git
git@gitee.com:lyn1001/mysql.git
lyn1001
mysql
mysql
master

搜索帮助