Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf, docs: Add abi.rst document to standardization subdirectory

As specified in the IETF BPF charter, the BPF working group has plans to
add one or more informational documents that recommend conventions and
guidelines for producing portable BPF program binaries. The
instruction-set.rst document currently contains a "Registers and calling
convention" subsection which dictates a calling convention that belongs
in an ABI document, rather than an instruction set document. Let's move
it to a new abi.rst document so we can clean it up. The abi.rst document
will of course be significantly changed and expanded upon over time. For
now, it's really just a placeholder which will contain ABI-specific
language that doesn't belong in other documents.

Signed-off-by: David Vernet <void@manifault.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230828155948.123405-3-void@manifault.com

authored by

David Vernet and committed by
Daniel Borkmann
deb88407 aee1720e

+26 -16
+25
Documentation/bpf/standardization/abi.rst
··· 1 + .. contents:: 2 + .. sectnum:: 3 + 4 + =================================================== 5 + BPF ABI Recommended Conventions and Guidelines v1.0 6 + =================================================== 7 + 8 + This is version 1.0 of an informational document containing recommended 9 + conventions and guidelines for producing portable BPF program binaries. 10 + 11 + Registers and calling convention 12 + ================================ 13 + 14 + BPF has 10 general purpose registers and a read-only frame pointer register, 15 + all of which are 64-bits wide. 16 + 17 + The BPF calling convention is defined as: 18 + 19 + * R0: return value from function calls, and exit value for BPF programs 20 + * R1 - R5: arguments for function calls 21 + * R6 - R9: callee saved registers that function calls will preserve 22 + * R10: read-only frame pointer to access stack 23 + 24 + R0 - R5 are scratch registers and BPF programs needs to spill/fill them if 25 + necessary across calls.
+1
Documentation/bpf/standardization/index.rst
··· 12 12 :maxdepth: 1 13 13 14 14 instruction-set 15 + abi 15 16 16 17 .. Links: 17 18 .. _IETF BPF Working Group: https://datatracker.ietf.org/wg/bpf/about/
-16
Documentation/bpf/standardization/instruction-set.rst
··· 97 97 A: 10000110 98 98 B: 11111111 10000110 99 99 100 - Registers and calling convention 101 - ================================ 102 - 103 - eBPF has 10 general purpose registers and a read-only frame pointer register, 104 - all of which are 64-bits wide. 105 - 106 - The eBPF calling convention is defined as: 107 - 108 - * R0: return value from function calls, and exit value for eBPF programs 109 - * R1 - R5: arguments for function calls 110 - * R6 - R9: callee saved registers that function calls will preserve 111 - * R10: read-only frame pointer to access stack 112 - 113 - R0 - R5 are scratch registers and eBPF programs needs to spill/fill them if 114 - necessary across calls. 115 - 116 100 Instruction encoding 117 101 ==================== 118 102