]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - samples/bpf/tracex2_kern.c
samples: bpf: enable trace samples for s390x
[karo-tx-linux.git] / samples / bpf / tracex2_kern.c
index dc50f4f2943f937d5c389e5384d39a0153d3f273..b32367cfbff4aff3020bb9c36c8faf6c981dd0f8 100644 (file)
@@ -27,10 +27,10 @@ int bpf_prog2(struct pt_regs *ctx)
        long init_val = 1;
        long *value;
 
-       /* x64 specific: read ip of kfree_skb caller.
+       /* x64/s390x specific: read ip of kfree_skb caller.
         * non-portable version of __builtin_return_address(0)
         */
-       bpf_probe_read(&loc, sizeof(loc), (void *)ctx->sp);
+       bpf_probe_read(&loc, sizeof(loc), (void *)PT_REGS_RET(ctx));
 
        value = bpf_map_lookup_elem(&my_map, &loc);
        if (value)
@@ -79,7 +79,7 @@ struct bpf_map_def SEC("maps") my_hist_map = {
 SEC("kprobe/sys_write")
 int bpf_prog3(struct pt_regs *ctx)
 {
-       long write_size = ctx->dx; /* arg3 */
+       long write_size = PT_REGS_PARM3(ctx);
        long init_val = 1;
        long *value;
        struct hist_key key = {};