diff options
author | Yonghong Song <yhs@fb.com> | 2022-08-31 08:26:52 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-09-06 19:51:14 -0700 |
commit | a9c5ad31fbdc4dec6d266fe22e51de1ad6d1bcf2 (patch) | |
tree | d048234fe685efd2e0bdedb4a62d6ed40f916ae6 /include/uapi/linux/bpf.h | |
parent | 720e6a435194fb5237833a4a7ec6aa60a78964a8 (diff) |
bpf: x86: Support in-register struct arguments in trampoline programs
In C, struct value can be passed as a function argument.
For small structs, struct value may be passed in
one or more registers. For trampoline based bpf programs,
this would cause complication since one-to-one mapping between
function argument and arch argument register is not valid
any more.
The latest llvm16 added bpf support to pass by values
for struct up to 16 bytes ([1]). This is also true for
x86_64 architecture where two registers will hold
the struct value if the struct size is >8 and <= 16.
This may not be true if one of struct member is 'double'
type but in current linux source code we don't have
such instance yet, so we assume all >8 && <= 16 struct
holds two general purpose argument registers.
Also change on-stack nr_args value to the number
of registers holding the arguments. This will
permit bpf_get_func_arg() helper to get all
argument values.
[1] https://reviews.llvm.org/D132144
Signed-off-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20220831152652.2078600-1-yhs@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/uapi/linux/bpf.h')
0 files changed, 0 insertions, 0 deletions