aboutsummaryrefslogtreecommitdiffstats
path: root/samples/bpf/bpf_helpers.h
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2015-07-06 10:20:07 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-08 18:17:45 -0400
commitd912557b346099584bbbfa8d3c1e101c46e33b59 (patch)
tree2752bc31be26f1c27776a0d52439efdd81f9eed7 /samples/bpf/bpf_helpers.h
parent7baaa9092dedad5f670a7b1716b2ce9e1175ba02 (diff)
samples: bpf: enable trace samples for s390x
The trace bpf samples do not compile on s390x because they use x86 specific fields from the "pt_regs" structure. Fix this and access the fields via new PT_REGS macros. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf/bpf_helpers.h')
-rw-r--r--samples/bpf/bpf_helpers.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/samples/bpf/bpf_helpers.h b/samples/bpf/bpf_helpers.h
index bdf1c1607b80..c77c872fe8ee 100644
--- a/samples/bpf/bpf_helpers.h
+++ b/samples/bpf/bpf_helpers.h
@@ -60,4 +60,29 @@ static int (*bpf_l3_csum_replace)(void *ctx, int off, int from, int to, int flag
60static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flags) = 60static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flags) =
61 (void *) BPF_FUNC_l4_csum_replace; 61 (void *) BPF_FUNC_l4_csum_replace;
62 62
63#if defined(__x86_64__)
64
65#define PT_REGS_PARM1(x) ((x)->di)
66#define PT_REGS_PARM2(x) ((x)->si)
67#define PT_REGS_PARM3(x) ((x)->dx)
68#define PT_REGS_PARM4(x) ((x)->cx)
69#define PT_REGS_PARM5(x) ((x)->r8)
70#define PT_REGS_RET(x) ((x)->sp)
71#define PT_REGS_FP(x) ((x)->bp)
72#define PT_REGS_RC(x) ((x)->ax)
73#define PT_REGS_SP(x) ((x)->sp)
74
75#elif defined(__s390x__)
76
77#define PT_REGS_PARM1(x) ((x)->gprs[2])
78#define PT_REGS_PARM2(x) ((x)->gprs[3])
79#define PT_REGS_PARM3(x) ((x)->gprs[4])
80#define PT_REGS_PARM4(x) ((x)->gprs[5])
81#define PT_REGS_PARM5(x) ((x)->gprs[6])
82#define PT_REGS_RET(x) ((x)->gprs[14])
83#define PT_REGS_FP(x) ((x)->gprs[11]) /* Works only with CONFIG_FRAME_POINTER */
84#define PT_REGS_RC(x) ((x)->gprs[2])
85#define PT_REGS_SP(x) ((x)->gprs[15])
86
87#endif
63#endif 88#endif