On Fri, 2023-01-13 at 00:33 -0800, Andrii Nakryiko wrote: > Define explicit table of registers used for syscall argument passing. > Note that we need custom overrides for PT_REGS_PARM1_[CORE_]SYSCALL > macros due to the need to use BPF CO-RE and custom local pt_regs > definitions to fetch orig_gpr2, storing 1st argument. > > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > --- > tools/lib/bpf/bpf_tracing.h | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/bpf/bpf_tracing.h > b/tools/lib/bpf/bpf_tracing.h > index 34ac0a2d7885..888beea6565b 100644 > --- a/tools/lib/bpf/bpf_tracing.h > +++ b/tools/lib/bpf/bpf_tracing.h > @@ -157,6 +157,10 @@ > > #elif defined(bpf_target_s390) > > +/* > + * > https://en.wikipedia.org/wiki/Calling_convention#IBM_System/360_and_successors > + */ > + Here is the more official ABI spec: https://github.com/IBM/s390x-abi/releases/download/v1.6/lzsabi_s390x.pdf > struct pt_regs___s390 { > unsigned long orig_gpr2; > }; > @@ -168,13 +172,22 @@ struct pt_regs___s390 { > #define __PT_PARM3_REG gprs[4] > #define __PT_PARM4_REG gprs[5] > #define __PT_PARM5_REG gprs[6] > + > +#define __PT_PARM1_SYSCALL_REG orig_gpr2 > +#define __PT_PARM2_SYSCALL_REG __PT_PARM2_REG > +#define __PT_PARM3_SYSCALL_REG __PT_PARM3_REG > +#define __PT_PARM4_SYSCALL_REG __PT_PARM4_REG > +#define __PT_PARM5_SYSCALL_REG __PT_PARM5_REG > +#define __PT_PARM6_SYSCALL_REG gprs[7] > +#define PT_REGS_PARM1_SYSCALL(x) PT_REGS_PARM1_CORE_SYSCALL(x) > +#define PT_REGS_PARM1_CORE_SYSCALL(x) \ > + BPF_CORE_READ((const struct pt_regs___s390 *)(x), > __PT_PARM1_SYSCALL_REG) > + > #define __PT_RET_REG gprs[14] > #define __PT_FP_REG gprs[11] /* Works only with > CONFIG_FRAME_POINTER */ > #define __PT_RC_REG gprs[2] > #define __PT_SP_REG gprs[15] > #define __PT_IP_REG psw.addr > -#define PT_REGS_PARM1_SYSCALL(x) PT_REGS_PARM1_CORE_SYSCALL(x) > -#define PT_REGS_PARM1_CORE_SYSCALL(x) BPF_CORE_READ((const struct > pt_regs___s390 *)(x), orig_gpr2) > > #elif defined(bpf_target_arm) > Acked-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>