xref: /linux/tools/testing/selftests/bpf/progs/verifier_jit_inline.c (revision 7d8d6ad659c02ed5d2387777194c22e8e81dbb2b)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <vmlinux.h>
4 #include <bpf/bpf_helpers.h>
5 #include "bpf_misc.h"
6 
7 SEC("fentry/bpf_fentry_test1")
8 __success __retval(0)
9 __arch_x86_64
10 __jited("	addq	%gs:{{.*}}, %rax")
11 __arch_arm64
12 __jited("	mrs	x8, SP_EL0")
13 __arch_riscv64
14 __jited("	mv	a5, tp")
15 __arch_loongarch
16 __jited("	move	$a5, $tp")
17 int inline_bpf_get_current_task(void)
18 {
19 	bpf_get_current_task();
20 
21 	return 0;
22 }
23 
24 SEC("fentry/bpf_fentry_test2")
25 __success __retval(0)
26 __arch_loongarch
27 __jited("	ld.wu	$a5, $tp, 16")
28 int inline_bpf_get_smp_processor_id(void)
29 {
30 	bpf_get_smp_processor_id();
31 
32 	return 0;
33 }
34 
35 char _license[] SEC("license") = "GPL";
36