bpf, docs: Clarify PC use in instruction-set.rst
Subsystems (3)
PATCH v2 1/1 bpf, docs: Clarify PC use in instruction-set.rst
This patch elaborates on the use of PC by expanding the PC acronym, explaining the units, and the relative position to which the offset applies.
v1->v2: reword per feedback from Alexei
Signed-off-by Dave Thaler <[email protected]>
--- Documentation/bpf/standardization/instruction-set.rst | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/bpf/standardization/instruction-set.rst +6 -0
@@ -469,6 +469,12 @@ JSLT 0xc any PC += offset if dst < src signed JSLE 0xd any PC += offset if dst <= src signed ======== ===== ======= ================================= =================================================== +where 'PC' denotes the program counter, and the offset to increment by +is in units of 64-bit instructions relative to the instruction following +the jump instruction. Thus 'PC += 1' skips execution of the next +instruction if it's a basic instruction and fails verification if the +next instruction is a 128-bit wide instruction. + The BPF program needs to store the return value into register R0 before doing an ``EXIT``.
Signature · 1 line
2.40.1
David Vernet
reviewerQuoted 16 lines · Dave Thaler
This patch elaborates on the use of PC by expanding the PC acronym, explaining the units, and the relative position to which the offset applies.
v1->v2: reword per feedback from AlexeiSigned-off-by Dave Thaler <[email protected]>--- Documentation/bpf/standardization/instruction-set.rst | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/bpf/standardization/instruction-set.rst +0
-0
Documentation/bpf/standardization/instruction-set.rst JSLT 0xc any PC += offset if dst < src signed · line 476
Quoted 8 lines
Documentation/bpf/standardization/instruction-set.rst +5
-0@@ -469,6 +469,12 @@ JSLT 0xc any PC += offset if dst < src signed JSLE 0xd any PC += offset if dst <= src signed ======== ===== ======= ================================= =================================================== +where 'PC' denotes the program counter, and the offset to increment by +is in units of 64-bit instructions relative to the instruction following +the jump instruction. Thus 'PC += 1' skips execution of the next +instruction if it's a basic instruction and fails verification if the +next instruction is a 128-bit wide instruction.
Should we say "results in undefined behavior" rather than "fails verification"? I'm not sure if we should be dictating verifier semantics in the ISA document.
Quoted 11 lines
Documentation/bpf/standardization/instruction-set.rst +1
-0+ The BPF program needs to store the return value into register R0 before doing an ``EXIT``.Signature · 6 lines
2.40.1 -- Bpf mailing list [email protected] https://www.ietf.org/mailman/listinfo/bpf