Skip to contentSkip to conversation

libbpf: Fix register in PT_REGS MIPS macros

PATCH In review Jerry Crunchtime 2 participants 2 messages Jul 31, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libbpf: Fix register in PT_REGS MIPS macros

v1 -> v2: Also fixed missed PT_REGS_RC_CORE macro

Hi.

The o32, n32 and n64 calling conventions require the return value to be stored in $v0 which maps to $2 register, i.e., the register 2.

Fixes c1932cd ("bpf: Add MIPS support to samples/bpf.")
---
 tools/lib/bpf/bpf_tracing.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/bpf/bpf_tracing.h +0 -0
index 58eceb884..eebf020cb 100644
@@ -215,7 +215,7 @@ struct pt_regs;
 #define PT_REGS_PARM5(x) ((x)->regs[8])
 #define PT_REGS_RET(x) ((x)->regs[31])
 #define PT_REGS_FP(x) ((x)->regs[30]) /* Works only with

CONFIG_FRAME_POINTER */
-#define PT_REGS_RC(x) ((x)->regs[1])
+#define PT_REGS_RC(x) ((x)->regs[2])
#define PT_REGS_SP(x) ((x)->regs[29])
#define PT_REGS_IP(x) ((x)->cp0_epc)

@@ -226,7 +226,7 @@ struct pt_regs;
#define PT_REGS_PARM5_CORE(x) BPF_CORE_READ((x), regs[8]) #define PT_REGS_RET_CORE(x) BPF_CORE_READ((x), regs[31]) #define PT_REGS_FP_CORE(x) BPF_CORE_READ((x), regs[30])
-#define PT_REGS_RC_CORE(x) BPF_CORE_READ((x), regs[1]) +#define PT_REGS_RC_CORE(x) BPF_CORE_READ((x), regs[2])
#define PT_REGS_SP_CORE(x) BPF_CORE_READ((x), regs[29]) #define PT_REGS_IP_CORE(x) BPF_CORE_READ((x), cp0_epc)

--
2.17.1

maintainer
#1 lore raw
Quoted 10 lines · Jerry Crunchtime

v1 -> v2: Also fixed missed PT_REGS_RC_CORE macro

Hi.

The o32, n32 and n64 calling conventions require the return value to be stored in $v0 which maps to $2 register, i.e., the register 2.

Fixes c1932cd ("bpf: Add MIPS support to samples/bpf.")

Patch was whitespace damaged, but fixed it up manually this time & applied, thanks!