mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 11:21:26 -04:00
Implementing BPF version of preempt_count() requires accessing lowcore from BPF. Since lowcore can be relocated, open-coding (struct lowcore *)0 does not work, so add a kfunc. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Link: https://lore.kernel.org/r/20260217160813.100855-2-iii@linux.ibm.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
13 lines
214 B
C
13 lines
214 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <asm/lowcore.h>
|
|
#include <linux/btf.h>
|
|
|
|
__bpf_kfunc_start_defs();
|
|
|
|
__bpf_kfunc struct lowcore *bpf_get_lowcore(void)
|
|
{
|
|
return get_lowcore();
|
|
}
|
|
|
|
__bpf_kfunc_end_defs();
|