mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 23:55:21 +07:00
af3c24e0e2
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>
29 lines
524 B
C
29 lines
524 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright (c) 2019 Facebook
|
|
#include <linux/sched.h>
|
|
#include <linux/ptrace.h>
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
#include <linux/bpf.h>
|
|
#include "bpf_helpers.h"
|
|
|
|
char _license[] SEC("license") = "GPL";
|
|
|
|
SEC("raw_tracepoint/kfree_skb")
|
|
int nested_loops(volatile struct pt_regs* ctx)
|
|
{
|
|
int i, j, sum = 0, m;
|
|
|
|
for (j = 0; j < 300; j++)
|
|
for (i = 0; i < j; i++) {
|
|
if (j & 1)
|
|
m = PT_REGS_RC(ctx);
|
|
else
|
|
m = j;
|
|
sum += i * m;
|
|
}
|
|
|
|
return sum;
|
|
}
|