selftests/bpf: fix compiling loop{1, 2, 3}.c on s390
authorIlya Leoshkevich <iii@linux.ibm.com>
Thu, 11 Jul 2019 14:29:30 +0000 (16:29 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 12 Jul 2019 13:38:23 +0000 (15:38 +0200)
Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Tested-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/progs/loop1.c
tools/testing/selftests/bpf/progs/loop2.c
tools/testing/selftests/bpf/progs/loop3.c

index dea395a..7cdb7f8 100644 (file)
@@ -18,7 +18,7 @@ int nested_loops(volatile struct pt_regs* ctx)
        for (j = 0; j < 300; j++)
                for (i = 0; i < j; i++) {
                        if (j & 1)
-                               m = ctx->rax;
+                               m = PT_REGS_RC(ctx);
                        else
                                m = j;
                        sum += i * m;
index 0637bd8..9b2f808 100644 (file)
@@ -16,7 +16,7 @@ int while_true(volatile struct pt_regs* ctx)
        int i = 0;
 
        while (true) {
-               if (ctx->rax & 1)
+               if (PT_REGS_RC(ctx) & 1)
                        i += 3;
                else
                        i += 7;
index 30a0f6c..d727657 100644 (file)
@@ -16,7 +16,7 @@ int while_true(volatile struct pt_regs* ctx)
        __u64 i = 0, sum = 0;
        do {
                i++;
-               sum += ctx->rax;
+               sum += PT_REGS_RC(ctx);
        } while (i < 0x100000000ULL);
        return sum;
 }