On 2023/1/13 16:33, Andrii Nakryiko wrote:
Add PARM6 through PARM8 definitions for RISC V (riscv) arch. Leave the
link for ABI doc for future reference.
Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
---
tools/lib/bpf/bpf_tracing.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
index 0f9640ddbe1c..579e2f830532 100644
--- a/tools/lib/bpf/bpf_tracing.h
+++ b/tools/lib/bpf/bpf_tracing.h
@@ -268,12 +268,19 @@ struct pt_regs___arm64 {
#elif defined(bpf_target_riscv)
+/*
+ * https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#risc-v-calling-conventions
+ */
+
#define __PT_REGS_CAST(x) ((const struct user_regs_struct *)(x))
#define __PT_PARM1_REG a0
#define __PT_PARM2_REG a1
#define __PT_PARM3_REG a2
#define __PT_PARM4_REG a3
#define __PT_PARM5_REG a4
+#define __PT_PARM6_REG a5
+#define __PT_PARM7_REG a6
+#define __PT_PARM8_REG a7
#define __PT_RET_REG ra
#define __PT_FP_REG s0
#define __PT_RC_REG a0
Hi Andrii,
Looks fine and tests passed as follow:
#233 uprobe_autoattach:OK
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
#19 bpf_syscall_macro:OK
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
Tested-by: Pu Lehui <pulehui@xxxxxxxxxx> # RISC-V
Best Regards,
Lehui