[PATCH bpf-next v2 1/3] bpf, arm64: Map BPF_REG_0 to x8 instead of x7

Will Deacon will at kernel.org
Thu May 28 06:42:28 PDT 2026


On Mon, Apr 27, 2026 at 04:47:58PM -0700, Puranjay Mohan wrote:
> Move the BPF return value register from x7 to x8, freeing x7 for use
> as an argument register. AAPCS64 designates x8 as the indirect result
> location register; it is caller-saved and not used for argument
> passing, making it a suitable home for BPF_REG_0.
> 
> This is a prerequisite for stack argument support, which needs x5-x7
> to pass arguments 6-8 to native kfuncs following the AAPCS64 calling
> convention.
> 
> Signed-off-by: Yonghong Song <yonghong.song at linux.dev>
> Signed-off-by: Puranjay Mohan <puranjay at kernel.org>
> ---
>  arch/arm64/net/bpf_jit_comp.c                          |  4 ++--
>  arch/arm64/net/bpf_timed_may_goto.S                    |  8 ++++----
>  .../testing/selftests/bpf/progs/verifier_jit_inline.c  |  2 +-
>  tools/testing/selftests/bpf/progs/verifier_ldsx.c      |  6 +++---
>  .../selftests/bpf/progs/verifier_private_stack.c       | 10 +++++-----
>  5 files changed, 15 insertions(+), 15 deletions(-)

Makes sense to me:

Acked-by: Will Deacon <will at kernel.org>

Will



More information about the linux-arm-kernel mailing list