[PATCH bpf-next v4 09/14] libbpf: Fix riscv register names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



struct pt_regs and struct user_regs_struct have different names for the
program counter: epc and pc respectively. Also, the frame pointer is
called s0, not fp.

Reported-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
---
 tools/lib/bpf/bpf_tracing.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
index 07e291d77e83..88ed5ba9510c 100644
--- a/tools/lib/bpf/bpf_tracing.h
+++ b/tools/lib/bpf/bpf_tracing.h
@@ -213,8 +213,11 @@
 
 #elif defined(bpf_target_riscv)
 
-#if !defined(__KERNEL__) && !defined(__VMLINUX_H__)
+#if defined(__KERNEL__) || defined(__VMLINUX_H__)
+#define __PT_IP_REG epc
+#else
 #define __PT_REGS_CAST(x) ((const struct user_regs_struct *)(x))
+#define __PT_IP_REG pc
 #endif
 
 #define __PT_PARM1_REG a0
@@ -223,10 +226,9 @@
 #define __PT_PARM4_REG a3
 #define __PT_PARM5_REG a4
 #define __PT_RET_REG ra
-#define __PT_FP_REG fp
+#define __PT_FP_REG s0
 #define __PT_RC_REG a5
 #define __PT_SP_REG sp
-#define __PT_IP_REG epc
 
 #endif
 
-- 
2.34.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux