Open
add sw_64 support #14
Venland1Add on Sep 3, 2025
add sw_64 support #14
Open
Merged fromrefs/pull/14/headintoopenEuler-25.09
Total: 2 files changed+65-1
| @@ -0,0 +1,60 @@ | |||
| 1 | + | ||
| 2 | +From 636f4e3060af9cd29365d8ee5f2b3cc4261bdcf6 Mon Sep 17 00:00:00 2001 | ||
| 3 | +From: =?UTF-8?q?=E9=A9=AC=E6=B5=B7=E4=BA=AE?= <ut002943@mhl> | ||
| 4 | +Date: Fri, 13 Jun 2025 10:02:57 +0800 | ||
| 5 | +Subject: [PATCH] add sw_64 support | ||
| 6 | +--- | ||
| 7 | + libbpf/src/bpf_tracing.h | 24 ++++++++++++++++++++++++ | ||
| 8 | + 1 file changed, 24 insertions(+) | ||
| 9 | +diff --git a/libbpf/src/bpf_tracing.h b/libbpf/src/bpf_tracing.h | ||
| 10 | +index 6fb3d0f..b5bc4d3 100644 | ||
| 11 | +--- a/libbpf/src/bpf_tracing.h | ||
| 12 | ++++ b/libbpf/src/bpf_tracing.h | ||
| 13 | +@@ -35,6 +35,9 @@ | ||
| 14 | + #elif defined(__TARGET_ARCH_loongarch) | ||
| 15 | + #define bpf_target_loongarch | ||
| 16 | + #define bpf_target_defined | ||
| 17 | ++#elif defined(__TARGET_ARCH_sw_64) | ||
| 18 | ++ #define bpf_target_sw64 | ||
| 19 | ++ #define bpf_target_defined | ||
| 20 | + #else | ||
| 21 | + | ||
| 22 | + /* Fall back to what the compiler says */ | ||
| 23 | +@@ -68,6 +71,9 @@ | ||
| 24 | + #elif defined(__loongarch__) | ||
| 25 | + #define bpf_target_loongarch | ||
| 26 | + #define bpf_target_defined | ||
| 27 | ++#elif defined(__sw_64__) | ||
| 28 | ++ #define bpf_target_sw64 | ||
| 29 | ++ #define bpf_target_defined | ||
| 30 | + #endif /* no compiler target */ | ||
| 31 | + | ||
| 32 | + #endif | ||
| 33 | +@@ -442,6 +448,24 @@ struct pt_regs___arm64 { | ||
| 34 | + #define __PT_SP_REG regs[3] | ||
| 35 | + #define __PT_IP_REG csr_era | ||
| 36 | + | ||
| 37 | ++#elif defined(bpf_target_sw64) | ||
| 38 | ++ | ||
| 39 | ++/* sw64 provides struct user_pt_regs instead of struct pt_regs to userspace */ | ||
| 40 | ++struct pt_regs; | ||
| 41 | ++#define PT_REGS_SW64 const volatile struct user_pt_regs | ||
| 42 | ++#define __PT_REGS_CAST(x) ((PT_REGS_SW64 *)(x)) | ||
| 43 | ++#define __PT_PARM1_REG regs[16] | ||
| 44 | ++#define __PT_PARM2_REG regs[17] | ||
| 45 | ++#define __PT_PARM3_REG regs[18] | ||
| 46 | ++#define __PT_PARM4_REG regs[19] | ||
| 47 | ++#define __PT_PARM5_REG regs[20] | ||
| 48 | ++#define __PT_RET_REG regs[26] | ||
| 49 | ++/* Works only with CONFIG_FRAME_POINTER */ | ||
| 50 | ++#define __PT_FP_REG regs[15] | ||
| 51 | ++#define __PT_RC_REG regs[0] | ||
| 52 | ++#define __PT_SP_REG regs[30] | ||
| 53 | ++#define __PT_IP_REG pc | ||
| 54 | ++ | ||
| 55 | + #endif | ||
| 56 | + | ||
| 57 | + #if defined(bpf_target_defined) | ||
| 58 | +-- | ||
| 59 | +2.20.1 | ||
| 60 | + | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | Name: bpftool | 1 | Name: bpftool |
| 2 | Version: 7.2.0 | 2 | Version: 7.2.0 |
| 3 | -Release: 2 | 3 | +Release: 3 |
| 4 | Summary: Tool for inspection and manipulation of BPF programs and maps | 4 | Summary: Tool for inspection and manipulation of BPF programs and maps |
| 5 | License: GPL-2.0-only | 5 | License: GPL-2.0-only |
| 6 | URL: https://www.kernel.org/ | 6 | URL: https://www.kernel.org/ |
| @@ -12,6 +12,7 @@ Patch0: bpftool-use-a-local-copy-of-perf_event-to-fix-access.patch | |||
| 12 | Patch1: bpftool-define-a-local-bpf_perf_link-to-fix-accessin.patch | 12 | Patch1: bpftool-define-a-local-bpf_perf_link-to-fix-accessin.patch |
| 13 | Patch2: bpftool-use-a-local-copy-of-bpf_link_type_perf_event.patch | 13 | Patch2: bpftool-use-a-local-copy-of-bpf_link_type_perf_event.patch |
| 14 | Patch3: bpftool-use-a-local-bpf_perf_event_value-to-fix-acce.patch | 14 | Patch3: bpftool-use-a-local-bpf_perf_event_value-to-fix-acce.patch |
| 15 | +Patch4: add-sw_64-support.patch | ||
| 15 | 16 | ||
| 16 | %description | 17 | %description |
| 17 | bpftool allows for inspection and simple modification of BPF objects (programs | 18 | bpftool allows for inspection and simple modification of BPF objects (programs |
| @@ -38,6 +39,9 @@ mv %{buildroot}%{_datadir}/bash-completion/completions/bpftool %{buildroot}%{_sy | |||
| 38 | %{_sysconfdir}/bash_completion.d/bpftool | 39 | %{_sysconfdir}/bash_completion.d/bpftool |
| 39 | 40 | ||
| 40 | %changelog | 41 | %changelog |
| 42 | +* Wed Sep 03 2025 liweigang <liweiganga@gmail.com> - 7.2.0-3 | ||
| 43 | +- add sw_64 support | ||
| 44 | + | ||
| 41 | * Mon Oct 28 2024 liwei <liwei883@huawei.com> - 7.2.0-2 | 45 | * Mon Oct 28 2024 liwei <liwei883@huawei.com> - 7.2.0-2 |
| 42 | - Add README | 46 | - Add README |
| 43 | 47 | ||