summaryrefslogtreecommitdiff
path: root/Documentation/bpf/linux-notes.rst
diff options
context:
space:
mode:
authorDave Thaler <dthaler@microsoft.com>2023-03-26 08:49:46 +0300
committerAlexei Starovoitov <ast@kernel.org>2023-04-03 03:02:54 +0300
commit16b7c970cc8192e929dbd5192ccc1867e19d7bda (patch)
tree44b5b5d57108cdf54b4896b686b369e97f20a1e4 /Documentation/bpf/linux-notes.rst
parent92b2e810f0d3a2c05d8cf12a800592b238d458df (diff)
downloadlinux-16b7c970cc8192e929dbd5192ccc1867e19d7bda.tar.xz
bpf, docs: Add docs on extended 64-bit immediate instructions
Add docs on extended 64-bit immediate instructions, including six instructions previously undocumented. Include a brief description of maps and variables, as used by those instructions. V1 -> V2: rebased on top of latest master V2 -> V3: addressed comments from Alexei V3 -> V4: addressed comments from David Vernet Signed-off-by: Dave Thaler <dthaler@microsoft.com> Link: https://lore.kernel.org/r/20230326054946.2331-1-dthaler1968@googlemail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'Documentation/bpf/linux-notes.rst')
-rw-r--r--Documentation/bpf/linux-notes.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/bpf/linux-notes.rst b/Documentation/bpf/linux-notes.rst
index f43b9c797bcb..508d009d3bed 100644
--- a/Documentation/bpf/linux-notes.rst
+++ b/Documentation/bpf/linux-notes.rst
@@ -20,6 +20,28 @@ integer would be read from a specified register, is not currently supported
by the verifier. Any programs with this instruction will fail to load
until such support is added.
+Maps
+====
+
+Linux only supports the 'map_val(map)' operation on array maps with a single element.
+
+Linux uses an fd_array to store maps associated with a BPF program. Thus,
+map_by_idx(imm) uses the fd at that index in the array.
+
+Variables
+=========
+
+The following 64-bit immediate instruction specifies that a variable address,
+which corresponds to some integer stored in the 'imm' field, should be loaded:
+
+========================= ====== === ========================================= =========== ==============
+opcode construction opcode src pseudocode imm type dst type
+========================= ====== === ========================================= =========== ==============
+BPF_IMM | BPF_DW | BPF_LD 0x18 0x3 dst = var_addr(imm) variable id data pointer
+========================= ====== === ========================================= =========== ==============
+
+On Linux, this integer is a BTF ID.
+
Legacy BPF Packet access instructions
=====================================