| 1 | |
| 2 |
|
| 3 | #include <vmlinux.h>
|
| 4 | #include <bpf/bpf_helpers.h>
|
| 5 | #include <bpf/bpf_tracing.h>
|
| 6 | #include "../test_kmods/bpf_testmod.h"
|
| 7 |
|
| 8 | char _license[] SEC("license") = "GPL";
|
| 9 |
|
| 10 | void bpf_testmod_ops3_call_test_2(void) __ksym;
|
| 11 |
|
| 12 | int val_i, val_j;
|
| 13 |
|
| 14 | __noinline static int subprog2(int *a, int *b)
|
| 15 | {
|
| 16 | return val_i + a[10] + b[20];
|
| 17 | }
|
| 18 |
|
| 19 | __noinline static int subprog1(int *a)
|
| 20 | {
|
| 21 |
|
| 22 | int b[50] = {};
|
| 23 |
|
| 24 | b[20] = 2;
|
| 25 | return subprog2(a, b);
|
| 26 | }
|
| 27 |
|
| 28 |
|
| 29 | SEC("struct_ops")
|
| 30 | int BPF_PROG(test_1)
|
| 31 | {
|
| 32 |
|
| 33 | int a[100] = {};
|
| 34 |
|
| 35 | a[10] = 1;
|
| 36 | val_i = subprog1(a);
|
| 37 | bpf_testmod_ops3_call_test_2();
|
| 38 | return 0;
|
| 39 | }
|
| 40 |
|
| 41 | SEC("struct_ops")
|
| 42 | int BPF_PROG(test_2)
|
| 43 | {
|
| 44 |
|
| 45 | int a[50] = {};
|
| 46 |
|
| 47 | a[10] = 3;
|
| 48 | val_j = subprog1(a);
|
| 49 | return 0;
|
| 50 | }
|
| 51 |
|
| 52 | SEC(".struct_ops")
|
| 53 | struct bpf_testmod_ops3 testmod_1 = {
|
| 54 | .test_1 = (void *)test_1,
|
| 55 | .test_2 = (void *)test_2,
|
| 56 | };
|