Skip to content

Commit deb8840

Browse files
Byte-Labborkmann
authored andcommitted
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 <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent aee1720 commit deb8840

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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.

Documentation/bpf/standardization/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ for the working group charter, documents, and more.
1212
:maxdepth: 1
1313

1414
instruction-set
15+
abi
1516

1617
.. Links:
1718
.. _IETF BPF Working Group: https://datatracker.ietf.org/wg/bpf/about/

Documentation/bpf/standardization/instruction-set.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,6 @@ Definitions
9797
A: 10000110
9898
B: 11111111 10000110
9999

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-
116100
Instruction encoding
117101
====================
118102

0 commit comments

Comments
 (0)