From: Dave Thaler Date: Fri, 26 Apr 2024 23:11:26 +0000 (-0700) Subject: bpf, docs: Clarify PC use in instruction-set.rst X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=07801a24e2f18624cd2400ce15f14569eb416c9a;p=linux.git 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. Signed-off-by: Dave Thaler Signed-off-by: Daniel Borkmann Reviewed-by: David Vernet Link: https://lore.kernel.org/bpf/20240426231126.5130-1-dthaler1968@gmail.com --- diff --git a/Documentation/bpf/standardization/instruction-set.rst b/Documentation/bpf/standardization/instruction-set.rst index b44bdacd01957..997560abadabe 100644 --- a/Documentation/bpf/standardization/instruction-set.rst +++ b/Documentation/bpf/standardization/instruction-set.rst @@ -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 or results in undefined behavior +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``.