代码拉取完成,页面将自动刷新
From 93391a6f90774d4e6ee3d21972ef937eb183067c Mon Sep 17 00:00:00 2001
From: Super User <root@localhost.localdomain>
Date: Fri, 14 Mar 2025 17:31:35 +0800
Subject: [PATCH] add sw_64 support
---
src/bpf_tracing.h | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/src/bpf_tracing.h b/src/bpf_tracing.h
index 6fb3d0f..ba30c3f 100644
--- a/src/bpf_tracing.h
+++ b/src/bpf_tracing.h
@@ -35,6 +35,9 @@
#elif defined(__TARGET_ARCH_loongarch)
#define bpf_target_loongarch
#define bpf_target_defined
+#elif defined(__TARGET_ARCH_sw_64)
+ #define bpf_target_sw64
+ #define bpf_target_defined
#else
/* Fall back to what the compiler says */
@@ -68,6 +71,9 @@
#elif defined(__loongarch__)
#define bpf_target_loongarch
#define bpf_target_defined
+#elif defined(__sw_64__)
+ #define bpf_target_sw64
+ #define bpf_target_defined
#endif /* no compiler target */
#endif
@@ -442,6 +448,35 @@ struct pt_regs___arm64 {
#define __PT_SP_REG regs[3]
#define __PT_IP_REG csr_era
+#elif defined(bpf_target_sw64)
+
+/* sw64 provides struct user_pt_regs instead of struct pt_regs to userspace */
+struct pt_regs;
+#define PT_REGS_SW64 const volatile struct user_pt_regs
+#define PT_REGS_PARM1(x) (((PT_REGS_SW64 *)(x))->regs[16])
+#define PT_REGS_PARM2(x) (((PT_REGS_SW64 *)(x))->regs[17])
+#define PT_REGS_PARM3(x) (((PT_REGS_SW64 *)(x))->regs[18])
+#define PT_REGS_PARM4(x) (((PT_REGS_SW64 *)(x))->regs[19])
+#define PT_REGS_PARM5(x) (((PT_REGS_SW64 *)(x))->regs[20])
+#define PT_REGS_RET(x) (((PT_REGS_SW64 *)(x))->regs[26])
+/* Works only with CONFIG_FRAME_POINTER */
+#define PT_REGS_FP(x) (((PT_REGS_SW64 *)(x))->regs[15])
+#define PT_REGS_RC(x) (((PT_REGS_SW64 *)(x))->regs[0])
+#define PT_REGS_SP(x) (((PT_REGS_SW64 *)(x))->regs[30])
+#define PT_REGS_IP(x) (((PT_REGS_SW64 *)(x))->pc)
+
+#define PT_REGS_PARM1_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[16])
+#define PT_REGS_PARM2_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[17])
+#define PT_REGS_PARM3_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[18])
+#define PT_REGS_PARM4_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[19])
+#define PT_REGS_PARM5_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[20])
+#define PT_REGS_RET_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[26])
+#define PT_REGS_FP_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[15])
+#define PT_REGS_RC_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[0])
+#define PT_REGS_SP_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), regs[30])
+#define PT_REGS_IP_CORE(x) BPF_CORE_READ((PT_REGS_SW64 *)(x), pc)
+
+
#endif
#if defined(bpf_target_defined)
--
2.43.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。