Skip to content

Commit

Permalink
selftests/bpf: fix compiling loop{1, 2, 3}.c on s390
Browse files Browse the repository at this point in the history
Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390.

Signed-off-by: Ilya Leoshkevich <[email protected]>
Reviewed-by: Stanislav Fomichev <[email protected]>
Tested-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
iii-i authored and borkmann committed Jul 12, 2019
1 parent 7cd0453 commit af3c24e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/progs/loop1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/progs/loop2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/progs/loop3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit af3c24e

Please sign in to comment.