Skip to content

Commit 3ec7ed7

Browse files
committed
eBPF.md: Document atomic add instructions
Atomic add instructions have been available since the early days of eBPF, although BPF_XADD has later been renamed into BPF_ATOMIC. Comes in 32 and 64 bits flavours. This is supported in the kernel since commit: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set")
1 parent 3bb548b commit 3ec7ed7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

eBPF.md

+14
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,17 @@ Opcode | Mnemonic | Pseudocode
225225
0xce | jslt dst, src, +off | PC += off if dst < src (signed)
226226
0xd6 | jsle dst, imm, +off | PC += off if dst <= imm (signed)
227227
0xde | jsle dst, src, +off | PC += off if dst <= src (signed)
228+
229+
## Atomic Instructions
230+
231+
### 64-bit
232+
233+
Opcode | Mnemonic | Pseudocode
234+
-------------------|----------------------------|---------------------------------------------------------
235+
0xdb (imm == 0x00) | add [dst+off], src | (dst + off) += src
236+
237+
### 32-bit
238+
239+
Opcode | Mnemonic | Pseudocode (uint32_t * casts omitted for readability)
240+
-------|----------------------------|---------------------------------------------------------------------
241+
0xc3 (imm == 0x00) | add32 [dst+off], src | (dst + off) += src

0 commit comments

Comments
 (0)