Skip to content

Commit 37e3229

Browse files
committed
eBPF.md: Document atomic_fetch_add instructions
Atomic fetch add instructions are a variant of the "atomic" instructions, when BPF_FETCH (1) and BPF_ADD (0) are added to the immediate field. This is supported in the kernel since commit: 5ca419f2864a ("bpf: Add BPF_FETCH field / create atomic_fetch_add instruction")
1 parent 31845b1 commit 37e3229

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

eBPF.md

+2
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@ Opcode | Mnemonic | Pseudocode
233233
Opcode | Mnemonic | Pseudocode
234234
-------------------|----------------------------|---------------------------------------------------------
235235
0xdb (imm == 0x00) | add [dst+off], src | (dst + off) += src
236+
0xdb (imm == 0x01) | fetch_add [dst+off], src | src = dst, (dst + off) += src
236237

237238
### 32-bit
238239

239240
Opcode | Mnemonic | Pseudocode (uint32_t * casts omitted for readability)
240241
-------|----------------------------|---------------------------------------------------------------------
241242
0xc3 (imm == 0x00) | add32 [dst+off], src | (dst + off) += src
243+
0xc3 (imm == 0x01) | fetch_add32 [dst+off], src | src = dst, (dst + off) += src

0 commit comments

Comments
 (0)