Linux Audio

Check our new training course

Loading...
Note: File does not exist in v6.8.
 1// SPDX-License-Identifier: GPL-2.0
 2
 3#include <vmlinux.h>
 4#include <bpf/bpf_helpers.h>
 5#include <bpf/bpf_tracing.h>
 6#include "../bpf_testmod/bpf_testmod.h"
 7
 8char _license[] SEC("license") = "GPL";
 9
10#if defined(__TARGET_ARCH_x86)
11bool skip __attribute((__section__(".data"))) = false;
12#else
13bool skip = true;
14#endif
15
16void bpf_testmod_ops3_call_test_2(void) __ksym;
17
18int val_i, val_j;
19
20__noinline static int subprog2(int *a, int *b)
21{
22	return val_i + a[10] + b[20];
23}
24
25__noinline static int subprog1(int *a)
26{
27	/* stack size 200 bytes */
28	int b[50] = {};
29
30	b[20] = 2;
31	return subprog2(a, b);
32}
33
34
35SEC("struct_ops")
36int BPF_PROG(test_1)
37{
38	/* stack size 400 bytes */
39	int a[100] = {};
40
41	a[10] = 1;
42	val_i = subprog1(a);
43	bpf_testmod_ops3_call_test_2();
44	return 0;
45}
46
47SEC("struct_ops")
48int BPF_PROG(test_2)
49{
50	/* stack size 200 bytes */
51	int a[50] = {};
52
53	a[10] = 3;
54	val_j = subprog1(a);
55	return 0;
56}
57
58SEC(".struct_ops")
59struct bpf_testmod_ops3 testmod_1 = {
60	.test_1 = (void *)test_1,
61	.test_2 = (void *)test_2,
62};