Commit 07801a24 authored by Dave Thaler's avatar Dave Thaler Committed by Daniel Borkmann

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: default avatarDave Thaler <dthaler1968@googlemail.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Reviewed-by: default avatarDavid Vernet <void@manifault.com>
Link: https://lore.kernel.org/bpf/20240426231126.5130-1-dthaler1968@gmail.com
parent 6e25bcf0
...@@ -469,6 +469,12 @@ JSLT 0xc any PC += offset if dst < src signed ...@@ -469,6 +469,12 @@ JSLT 0xc any PC += offset if dst < src signed
JSLE 0xd 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 The BPF program needs to store the return value into register R0 before doing an
``EXIT``. ``EXIT``.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment