Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ISA documentation #4

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7b3d3b4
Add more links to ISA readme
dthaler Sep 22, 2022
71c9076
Update ISA documentation
dthaler Aug 29, 2022
b424eb0
Move legacy packet instructions to linux historical notes
dthaler Sep 13, 2022
d6c2740
Feedback from Shung-Hsi Yu
dthaler Sep 14, 2022
874fb82
Add note about invalid instruction 0x8d used by clang -O0
dthaler Sep 14, 2022
31e6a1c
Add src column to Appendix table
dthaler Sep 14, 2022
22b3a5b
Fix construction of imm64
dthaler Sep 14, 2022
712a32d
Add additional 0x18 opcodes by src value
dthaler Sep 14, 2022
bfb4831
Minor cleanup
dthaler Sep 16, 2022
f831770
Specify modulo with negative numbers
dthaler Sep 16, 2022
508e6fd
Address feedback from Quentin
dthaler Sep 21, 2022
ae38325
Add extended call instructions
dthaler Sep 21, 2022
33c190f
Move all Linux implementation notes to a separate document
dthaler Sep 21, 2022
b80f558
Move Clang notes to a separate document
dthaler Sep 21, 2022
0f30bc1
Redo versioning to just state the latest version is v1.0
dthaler Sep 21, 2022
d230335
Add note about documentation conventions
dthaler Sep 21, 2022
6e145d2
Fix asterisk escaping
dthaler Sep 22, 2022
794b4fd
Fix jump opcode table format
dthaler Sep 22, 2022
96a8094
Fix Appendix rows for opcode 0x18
dthaler Sep 22, 2022
b786e45
Fix modulo 0 result
dthaler Sep 22, 2022
ef22d47
Fix 4-bit code field values in tables
dthaler Sep 23, 2022
d491049
Fix URL
dthaler Sep 23, 2022
3b9470a
Fix definition of modulo
dthaler Sep 24, 2022
5bd09ab
Fix formatting
dthaler Sep 25, 2022
847b1cd
Fix typo
dthaler Nov 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions isa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ Some documentation links include:
* https://www.kernel.org/doc/Documentation/networking/filter.txt
* https://pchaigno.github.io/bpf/2021/10/20/ebpf-instruction-sets.html
* https://www.kernel.org/doc/html/latest/bpf/bpf_design_QA.html#instruction-level-questions
* https://lore.kernel.org/bpf/[email protected]/
* https://github.com/iovisor/bpf-docs/pull/26/files

Some implementation links include:

* https://github.com/iovisor/ubpf/blob/master/vm/ebpf.h
* https://github.com/generic-ebpf/generic-ebpf/blob/dev/sys/sys/ebpf_vm_isa.h
* https://github.com/vbpf/ebpf-verifier/blob/main/src/ebpf_vm_isa.hpp
* https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/bpf.h
* https://lore.kernel.org/bpf/[email protected]/
* https://github.com/iovisor/bpf-docs/pull/26/files
35 changes: 35 additions & 0 deletions isa/kernel.org/clang-notes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. contents::
.. sectnum::

==========================
Clang implementation notes
==========================

This document provides more details specific to the Clang/LLVM implementation of the eBPF instruction set.

Versions
========

Clang defined "CPU" versions, where a CPU version of 3 corresponds to the current eBPF ISA.

Clang can select the eBPF ISA version using ``-mcpu=v3`` for example to select version 3.

Arithmetic instructions
=======================

For CPU versions prior to 3, Clang v7.0 and later can enable ``BPF_ALU`` support with
``-Xclang -target-feature -Xclang +alu32``. In CPU version 3, support is automatically included.

Invalid instructions
====================

Clang will generate the invalid ``BPF_CALL | BPF_X | BPF_JMP`` (0x8d) instruction if ``-O0`` is used.

Atomic operations
=================

Clang can generate atomic instructions by default when ``-mcpu=v3`` is
enabled. If a lower version for ``-mcpu`` is set, the only atomic instruction
Clang can generate is ``BPF_ADD`` *without* ``BPF_FETCH``. If you need to enable
the atomics features, while keeping a lower ``-mcpu`` version, you can use
``-Xclang -target-feature -Xclang +alu32``.
Loading