Skip to content

Commit fb213ec

Browse files
Yonghong SongAlexei Starovoitov
Yonghong Song
authored and
Alexei Starovoitov
committed
docs/bpf: Fix malformed documentation
Two issues are fixed: 1. Malformed table due to newly-introduced BPF_MOVSX 2. Missing reference link for ``Sign-extension load operations`` Fixes: 245d4c4 ("docs/bpf: Add documentation for new instructions") Cc: [email protected] Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent eb03993 commit fb213ec

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

Documentation/bpf/standardization/instruction-set.rst

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -154,27 +154,27 @@ otherwise identical operations.
154154
The 'code' field encodes the operation as below, where 'src' and 'dst' refer
155155
to the values of the source and destination registers, respectively.
156156

157-
======== ===== ======= ==========================================================
158-
code value offset description
159-
======== ===== ======= ==========================================================
160-
BPF_ADD 0x00 0 dst += src
161-
BPF_SUB 0x10 0 dst -= src
162-
BPF_MUL 0x20 0 dst \*= src
163-
BPF_DIV 0x30 0 dst = (src != 0) ? (dst / src) : 0
164-
BPF_SDIV 0x30 1 dst = (src != 0) ? (dst s/ src) : 0
165-
BPF_OR 0x40 0 dst \|= src
166-
BPF_AND 0x50 0 dst &= src
167-
BPF_LSH 0x60 0 dst <<= (src & mask)
168-
BPF_RSH 0x70 0 dst >>= (src & mask)
169-
BPF_NEG 0x80 0 dst = -dst
170-
BPF_MOD 0x90 0 dst = (src != 0) ? (dst % src) : dst
171-
BPF_SMOD 0x90 1 dst = (src != 0) ? (dst s% src) : dst
172-
BPF_XOR 0xa0 0 dst ^= src
173-
BPF_MOV 0xb0 0 dst = src
174-
BPF_MOVSX 0xb0 8/16/32 dst = (s8,s16,s32)src
175-
BPF_ARSH 0xc0 0 sign extending dst >>= (src & mask)
176-
BPF_END 0xd0 0 byte swap operations (see `Byte swap instructions`_ below)
177-
======== ===== ======= ==========================================================
157+
========= ===== ======= ==========================================================
158+
code value offset description
159+
========= ===== ======= ==========================================================
160+
BPF_ADD 0x00 0 dst += src
161+
BPF_SUB 0x10 0 dst -= src
162+
BPF_MUL 0x20 0 dst \*= src
163+
BPF_DIV 0x30 0 dst = (src != 0) ? (dst / src) : 0
164+
BPF_SDIV 0x30 1 dst = (src != 0) ? (dst s/ src) : 0
165+
BPF_OR 0x40 0 dst \|= src
166+
BPF_AND 0x50 0 dst &= src
167+
BPF_LSH 0x60 0 dst <<= (src & mask)
168+
BPF_RSH 0x70 0 dst >>= (src & mask)
169+
BPF_NEG 0x80 0 dst = -dst
170+
BPF_MOD 0x90 0 dst = (src != 0) ? (dst % src) : dst
171+
BPF_SMOD 0x90 1 dst = (src != 0) ? (dst s% src) : dst
172+
BPF_XOR 0xa0 0 dst ^= src
173+
BPF_MOV 0xb0 0 dst = src
174+
BPF_MOVSX 0xb0 8/16/32 dst = (s8,s16,s32)src
175+
BPF_ARSH 0xc0 0 sign extending dst >>= (src & mask)
176+
BPF_END 0xd0 0 byte swap operations (see `Byte swap instructions`_ below)
177+
========= ===== ======= ==========================================================
178178

179179
Underflow and overflow are allowed during arithmetic operations, meaning
180180
the 64-bit or 32-bit value will wrap. If eBPF program execution would
@@ -397,6 +397,9 @@ instructions that transfer data between a register and memory.
397397
Where size is one of: ``BPF_B``, ``BPF_H``, ``BPF_W``, or ``BPF_DW`` and
398398
'unsigned size' is one of u8, u16, u32 or u64.
399399

400+
Sign-extension load operations
401+
------------------------------
402+
400403
The ``BPF_MEMSX`` mode modifier is used to encode sign-extension load
401404
instructions that transfer data between a register and memory.
402405

0 commit comments

Comments
 (0)