1 Star 0 Fork 27

YukariChiba/papi

forked from src-openEuler/papi 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
papi-riscv-support.patch 2.15 KB
一键复制 编辑 原始数据 按行查看 历史
diff --color -urN papi-6.0.0/src/configure papi-6.0.0-new/src/configure
--- papi-6.0.0/src/configure 2020-03-04 23:56:58.000000000 +0800
+++ papi-6.0.0-new/src/configure 2022-07-04 19:45:58.799472304 +0800
@@ -4709,7 +4709,7 @@
# First set pthread-mutexes based on arch
case $arch in
- aarch64|arm*|parisc*)
+ aarch64|arm*|parisc*|riscv64)
pthread_mutexes=yes
CFLAGS="$CFLAGS -DUSE_PTHREAD_MUTEXES"
echo "forcing use of pthread mutexes... " >&6
diff --color -urN papi-6.0.0/src/linux-context.h papi-6.0.0-new/src/linux-context.h
--- papi-6.0.0/src/linux-context.h 2020-03-04 23:57:01.000000000 +0800
+++ papi-6.0.0-new/src/linux-context.h 2022-07-04 19:45:58.799472304 +0800
@@ -18,6 +18,8 @@
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.gregs[REG_EIP]
#elif defined(__x86_64__)
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.gregs[REG_RIP]
+#elif defined(__riscv)
+#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.__gregs[REG_PC]
#elif defined(__powerpc__) && !defined(__powerpc64__)
/*
* The index of the Next IP (REG_NIP) was obtained by looking at kernel
diff --color -urN papi-6.0.0/src/linux-timer.c papi-6.0.0-new/src/linux-timer.c
--- papi-6.0.0/src/linux-timer.c 2020-03-04 23:57:01.000000000 +0800
+++ papi-6.0.0-new/src/linux-timer.c 2022-07-04 19:46:32.745412162 +0800
@@ -246,6 +246,19 @@
}
/************************/
+/* RISC-V get_cycles() */
+/************************/
+
+#elif defined(__riscv)
+static inline long long
+get_cycles( void )
+{
+ register unsigned long ret;
+ __asm__ __volatile__ ("rdtime %0" : "=r" (ret));
+ return ret;
+}
+
+/************************/
/* POWER get_cycles() */
/************************/
diff --color -urN papi-6.0.0/src/mb.h papi-6.0.0-new/src/mb.h
--- papi-6.0.0/src/mb.h 2020-03-04 23:57:01.000000000 +0800
+++ papi-6.0.0-new/src/mb.h 2022-07-04 19:45:58.799472304 +0800
@@ -10,6 +10,9 @@
#elif defined (__s390__)
#define rmb() asm volatile("bcr 15,0" ::: "memory")
+#elif defined (__riscv)
+#define rmb() asm volatile("fence r,r" : : : "memory");
+
#elif defined (__sh__)
#if defined(__SH4A__) || defined(__SH5__)
#define rmb() asm volatile("synco" ::: "memory")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/YukariChiba/papi.git
git@gitee.com:YukariChiba/papi.git
YukariChiba
papi
papi
master

搜索帮助