xref: /linux/tools/testing/selftests/bpf/progs/kprobe_write_ctx.c (revision ae28ed4578e6d5a481e39c5a9827f27048661fdd)
1 // SPDX-License-Identifier: GPL-2.0
2 #include "vmlinux.h"
3 #include <bpf/bpf_helpers.h>
4 #include <bpf/bpf_tracing.h>
5 
6 char _license[] SEC("license") = "GPL";
7 
8 #if defined(__TARGET_ARCH_x86)
9 SEC("kprobe")
10 int kprobe_write_ctx(struct pt_regs *ctx)
11 {
12 	ctx->ax = 0;
13 	return 0;
14 }
15 
16 SEC("kprobe.multi")
17 int kprobe_multi_write_ctx(struct pt_regs *ctx)
18 {
19 	ctx->ax = 0;
20 	return 0;
21 }
22 #endif
23