Commit 62e46838 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alexei Starovoitov

bpf, docs: Add a setion to explain the basic instruction encoding

The eBPF instruction set document does not currently document the basic
instruction encoding.  Add a section to do that.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220103183556.41040-2-hch@lst.de
parent ca796fe6
...@@ -19,8 +19,22 @@ The eBPF calling convention is defined as: ...@@ -19,8 +19,22 @@ The eBPF calling convention is defined as:
R0 - R5 are scratch registers and eBPF programs needs to spill/fill them if R0 - R5 are scratch registers and eBPF programs needs to spill/fill them if
necessary across calls. necessary across calls.
Instruction encoding
====================
eBPF uses 64-bit instructions with the following encoding:
============= ======= =============== ==================== ============
32 bits (MSB) 16 bits 4 bits 4 bits 8 bits (LSB)
============= ======= =============== ==================== ============
immediate offset source register destination register opcode
============= ======= =============== ==================== ============
Note that most instructions do not use all of the fields.
Unused fields shall be cleared to zero.
Instruction classes Instruction classes
=================== -------------------
The three LSB bits of the 'opcode' field store the instruction class: The three LSB bits of the 'opcode' field store the instruction class:
......
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