Skip to content

Commit 3e3dc6c

Browse files
committed
Try note markup
Signed-off-by: Dave Thaler <[email protected]>
1 parent a456e6b commit 3e3dc6c

File tree

1 file changed

+39
-23
lines changed

1 file changed

+39
-23
lines changed

isa/kernel.org/instruction-set.rst

+39-23
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ Versions
1414
The current Instruction Set Architecture (ISA) version, sometimes referred to in other documents
1515
as a "CPU" version, is 3. This document also covers older versions of the ISA.
1616

17-
*Clang implementation note*: Clang can select the eBPF ISA version using
18-
``-mcpu=v2`` for example to select version 2.
17+
**Note**
18+
19+
*Clang implementation*: Clang can select the eBPF ISA version using
20+
``-mcpu=v2`` for example to select version 2.
1921

2022
Registers and calling convention
2123
================================
@@ -37,18 +39,22 @@ that the value in the register is moved to the BPF stack. The reverse operation
3739
of moving the variable from the BPF stack to the register is called filling.
3840
The reason for spilling/filling is due to the limited number of registers.
3941

40-
*Linux implementation note*: In the Linux kernel, the exit value for eBPF
41-
programs is passed as a 32 bit value.
42+
**Note**
43+
44+
*Linux implementation*: In the Linux kernel, the exit value for eBPF
45+
programs is passed as a 32 bit value.
4246

4347
Upon entering execution of an eBPF program, registers R1 - R5 initially can contain
4448
the input arguments for the program (similar to the argc/argv pair for a typical C program).
4549
The actual number of registers used, and their meaning, is defined by the program type;
4650
for example, a networking program might have an argument that includes network packet data
4751
and/or metadata.
4852

49-
*Linux implementation note*: In the Linux kernel, all program types only use
50-
R1 which contains the "context", which is typically a structure containing all
51-
the inputs needed.
53+
**Note**
54+
55+
*Linux implementation*: In the Linux kernel, all program types only use
56+
R1 which contains the "context", which is typically a structure containing all
57+
the inputs needed.
5258

5359
Instruction encoding
5460
====================
@@ -162,9 +168,11 @@ otherwise identical operations.
162168
Support for ``BPF_ALU`` is required in ISA version 3, and optional in earlier
163169
versions.
164170

165-
*Clang implementation note*:
166-
For ISA versions prior to 3, Clang v7.0 and later can enable ``BPF_ALU`` support with
167-
``-Xclang -target-feature -Xclang +alu32``.
171+
**Note**
172+
173+
*Clang implementation*:
174+
For ISA versions prior to 3, Clang v7.0 and later can enable ``BPF_ALU`` support with
175+
``-Xclang -target-feature -Xclang +alu32``.
168176

169177
The 4-bit 'code' field encodes the operation as follows:
170178

@@ -202,9 +210,11 @@ Examples:
202210

203211
where '(uint32_t)' indicates truncation to 32 bits.
204212

205-
*Linux implementation note*: In the Linux kernel, uint32_t is expressed as u32,
206-
uint64_t is expressed as u64, etc. This document uses the standard C terminology
207-
as the cross-platform specification.
213+
**Note**
214+
215+
*Linux implementation*: In the Linux kernel, uint32_t is expressed as u32,
216+
uint64_t is expressed as u64, etc. This document uses the standard C terminology
217+
as the cross-platform specification.
208218

209219
``BPF_ADD | BPF_X | BPF_ALU64`` (0x0f) means::
210220

@@ -239,9 +249,11 @@ used to select what byte order the operation converts from or to:
239249
BPF_TO_BE 0x08 convert between host byte order and big endian
240250
========= ===== =================================================
241251

242-
*Linux implementation note*:
243-
``BPF_FROM_LE`` and ``BPF_FROM_BE`` exist as aliases for ``BPF_TO_LE`` and
244-
``BPF_TO_BE`` respectively.
252+
**Note**
253+
254+
*Linux implementation*:
255+
``BPF_FROM_LE`` and ``BPF_FROM_BE`` exist as aliases for ``BPF_TO_LE`` and
256+
``BPF_TO_BE`` respectively.
245257

246258
The 'imm' field encodes the width of the swap operations. The following widths
247259
are supported: 16, 32 and 64. The following table summarizes the resulting
@@ -443,12 +455,14 @@ The ``BPF_CMPXCHG`` operation atomically compares the value addressed by
443455
value that was at ``dst + offset`` before the operation is zero-extended
444456
and loaded back to ``R0``.
445457

446-
*Clang implementation note*:
447-
Clang can generate atomic instructions by default when ``-mcpu=v3`` is
448-
enabled. If a lower version for ``-mcpu`` is set, the only atomic instruction
449-
Clang can generate is ``BPF_ADD`` *without* ``BPF_FETCH``. If you need to enable
450-
the atomics features, while keeping a lower ``-mcpu`` version, you can use
451-
``-Xclang -target-feature -Xclang +alu32``.
458+
**Note**
459+
460+
*Clang implementation*:
461+
Clang can generate atomic instructions by default when ``-mcpu=v3`` is
462+
enabled. If a lower version for ``-mcpu`` is set, the only atomic instruction
463+
Clang can generate is ``BPF_ADD`` *without* ``BPF_FETCH``. If you need to enable
464+
the atomics features, while keeping a lower ``-mcpu`` version, you can use
465+
``-Xclang -target-feature -Xclang +alu32``.
452466

453467
64-bit immediate instructions
454468
-----------------------------
@@ -488,7 +502,9 @@ These instructions have seven implicit operands:
488502
* Registers R1-R5 are scratch registers that are clobbered by the
489503
instruction.
490504

491-
*Linux implementation note*: In Linux, R6 references a struct sk_buff.
505+
**Note**
506+
507+
*Linux implementation*: In Linux, R6 references a struct sk_buff.
492508

493509
These instructions have an implicit program exit condition as well. If an
494510
eBPF program attempts access data beyond the packet boundary, the

0 commit comments

Comments
 (0)