]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gas/doc/c-bpf.texi
a3814e95c3a9eca5af417ec2307f773a5e8e0371
[thirdparty/binutils-gdb.git] / gas / doc / c-bpf.texi
1 @c Copyright (C) 2019-2023 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
4
5 @ifset GENERIC
6 @page
7 @node BPF-Dependent
8 @chapter BPF Dependent Features
9 @end ifset
10
11 @ifclear GENERIC
12 @node Machine Dependencies
13 @chapter BPF Dependent Features
14 @end ifclear
15
16 @cindex BPF support
17 @menu
18 * BPF Options:: BPF specific command-line options.
19 * BPF Special Characters:: Comments and statements.
20 * BPF Registers:: Register names.
21 * BPF Directives:: Machine directives.
22 * BPF Instructions:: Machine instructions.
23 @end menu
24
25 @node BPF Options
26 @section BPF Options
27 @cindex BPF options (none)
28 @cindex options for BPF (none)
29
30 @c man begin OPTIONS
31 @table @gcctabopt
32
33 @cindex @option{-EB} command-line option, BPF
34 @item -EB
35 This option specifies that the assembler should emit big-endian eBPF.
36
37 @cindex @option{-EL} command-line option, BPF
38 @item -EL
39 This option specifies that the assembler should emit little-endian
40 eBPF.
41
42 @cindex @option{-mdialect} command-line options, BPF
43 @item -mdialect=@var{dialect}
44 This option specifies the assembly language dialect to recognize while
45 assembling. The assembler supports @option{normal} and
46 @option{pseudoc}.
47
48 @cindex @option{-misa-spec} command-line options, BPF
49 @item -misa-spec=@var{spec}
50 This option specifies the version of the BPF instruction set to use
51 when assembling. The BPF ISA versions supported are @option{v1} @option{v2}, @option{v3} and @option{v4}.
52
53 The value @option{xbpf} can be specified to recognize extra
54 instructions that are used by GCC for testing purposes. But beware
55 this is not valid BPF.
56 @end table
57
58 Note that if no endianness option is specified in the command line,
59 the host endianness is used.
60 @c man end
61
62 @node BPF Special Characters
63 @section BPF Special Characters
64
65 @cindex line comment character, BPF
66 @cindex BPF line comment character
67 The presence of a @samp{;} on a line indicates the start of a comment
68 that extends to the end of the current line. If a @samp{#} appears as
69 the first character of a line, the whole line is treated as a comment.
70
71 @cindex statement separator, BPF
72 Statements and assembly directives are separated by newlines.
73
74 @node BPF Registers
75 @section BPF Registers
76
77 @cindex BPF register names
78 @cindex register names, BPF
79 The eBPF processor provides ten general-purpose 64-bit registers,
80 which are read-write, and a read-only frame pointer register:
81
82 @noindent
83 In normal syntax:
84
85 @table @samp
86 @item %r0 .. %r9
87 General-purpose registers.
88 @item %r10
89 @itemx %fp
90 Read-only frame pointer register.
91 @end table
92
93 All BPF registers are 64-bit long. However, in the Pseudo-C syntax
94 registers can be referred using different names, which actually
95 reflect the kind of instruction they appear on:
96
97 @noindent
98 In pseudoc syntax:
99
100 @table @samp
101 @item r0..r9
102 General-purpose register in an instruction that operates on its value
103 as if it was a 64-bit value.
104 @item w0..w9
105 General-purpose register in an instruction that operates on its value
106 as if it was a 32-bit value.
107 @item r10
108 Read-only frame pointer register.
109 @end table
110
111 @noindent
112 Note that in the Pseudo-C syntax register names are not preceded by
113 @code{%} characters.
114
115 @node BPF Directives
116 @section BPF Directives
117
118 @cindex machine directives, BPF
119
120 The BPF version of @code{@value{AS}} supports the following additional
121 machine directives:
122
123 @table @code
124 @cindex @code{half} directive, BPF
125 @item .word
126 The @code{.half} directive produces a 16 bit value.
127
128 @cindex @code{word} directive, BPF
129 @item .word
130 The @code{.word} directive produces a 32 bit value.
131
132 @cindex @code{dword} directive, BPF
133 @item .dword
134 The @code{.dword} directive produces a 64 bit value.
135 @end table
136
137 @node BPF Instructions
138 @section BPF Instructions
139
140 @cindex BPF opcodes
141 @cindex opcodes for BPF
142 In the instruction descriptions below the following field descriptors
143 are used:
144
145 @table @code
146 @item rd
147 Destination general-purpose register whose role is to be the
148 destination of an operation.
149 @item rs
150 Source general-purpose register whose role is to be the source of an
151 operation.
152 @item disp16
153 16-bit signed PC-relative offset, measured in number of 64-bit words,
154 minus one.
155 @item disp32
156 32-bit signed PC-relative offset, measured in number of 64-bit words,
157 minus one.
158 @item offset16
159 Signed 16-bit immediate representing an offset in bytes.
160 @item disp16
161 Signed 16-bit immediate representing a displacement to a target,
162 measured in number of 64-bit words @emph{minus one}.
163 @item imm32
164 Signed 32-bit immediate.
165 @item imm64
166 Signed 64-bit immediate.
167 @end table
168
169 @subsection Arithmetic instructions
170
171 The destination register in these instructions act like an
172 accumulator.
173
174 Note that in pseudoc syntax these instructions should use @code{r}
175 registers.
176
177 @table @code
178 @item add rd, rs
179 @itemx add rd, imm32
180 @itemx rd += rs
181 @itemx rd += imm32
182 64-bit arithmetic addition.
183
184 @item sub rd, rs
185 @itemx sub rd, rs
186 @itemx rd -= rs
187 @itemx rd -= imm32
188 64-bit arithmetic subtraction.
189
190 @item mul rd, rs
191 @itemx mul rd, imm32
192 @itemx rd *= rs
193 @itemx rd *= imm32
194 64-bit arithmetic multiplication.
195
196 @item div rd, rs
197 @itemx div rd, imm32
198 @itemx rd /= rs
199 @itemx rd /= imm32
200 64-bit arithmetic integer division.
201
202 @item mod rd, rs
203 @itemx mod rd, imm32
204 @itemx rd %= rs
205 @itemx rd %= imm32
206 64-bit integer remainder.
207
208 @item and rd, rs
209 @itemx and rd, imm32
210 @itemx rd &= rs
211 @itemx rd &= imm32
212 64-bit bit-wise ``and'' operation.
213
214 @item or rd, rs
215 @itemx or rd, imm32
216 @itemx rd |= rs
217 @itemx rd |= imm32
218 64-bit bit-wise ``or'' operation.
219
220 @item xor rd, imm32
221 @itemx xor rd, rs
222 @itemx rd ^= rs
223 @itemx rd ^= imm32
224 64-bit bit-wise exclusive-or operation.
225
226 @item lsh rd, rs
227 @itemx ldh rd, imm32
228 @itemx rd <<= rs
229 @itemx rd <<= imm32
230 64-bit left shift, by @code{rs} or @code{imm32} bits.
231
232 @item rsh %d, %s
233 @itemx rsh rd, imm32
234 @itemx rd >>= rs
235 @itemx rd >>= imm32
236 64-bit right logical shift, by @code{rs} or @code{imm32} bits.
237
238 @item arsh rd, rs
239 @itemx arsh rd, imm32
240 @itemx rd s>>= rs
241 @itemx rd s>>= imm32
242 64-bit right arithmetic shift, by @code{rs} or @code{imm32} bits.
243
244 @item neg rd, rs
245 @itemx neg rd, imm32
246 @itemx rd = - rs
247 @itemx rd = - imm32
248 64-bit arithmetic negation.
249
250 Note that in the @code{rd = - imm32} syntax there must be at least
251 one white space between @code{-} and @code{imm32}. Otherwise the
252 instruction is parsed as a @code{mov rd, imm32} instruction with a
253 negative 32-bit immediate. This is a consequence of a syntactic
254 ambiguity in the pseudoc syntax.
255
256 @item mov rd, rs
257 @itemx mov rd, imm32
258 @itemx rd = rs
259 @itemx rd = imm32
260 Move the 64-bit value of @code{rs} in @code{rd}, or load @code{imm32}
261 in @code{rd}.
262
263 @item movs rd, rs, 8
264 @itemx rd s= (i8) rs
265 Move the sign-extended 8-bit value in @code{rs} to @code{rd}.
266
267 @item movs rd, rs, 16
268 @itemx rd s= (i16) rs
269 Move the sign-extended 16-bit value in @code{rs} to @code{rd}.
270
271 @item movs rd, rs, 32
272 @itemx rd s= (i32) rs
273 Move the sign-extended 32-bit value in @code{rs} to @code{rd}.
274 @end table
275
276 @subsection 32-bit arithmetic instructions
277
278 The destination register in these instructions act as an accumulator.
279
280 Note that in pseudoc syntax these instructions should use @code{w}
281 registers. It is not allowed to mix @code{w} and @code{r} registers
282 in the same instruction.
283
284 @table @code
285 @item add32 rd, rs
286 @itemx add32 rd, imm32
287 @itemx rd += rs
288 @itemx rd += imm32
289 32-bit arithmetic addition.
290
291 @item sub32 rd, rs
292 @itemx sub32 rd, imm32
293 @itemx rd -= rs
294 @itemx rd += imm32
295 32-bit arithmetic subtraction.
296
297 @item mul32 rd, rs
298 @itemx mul32 rd, imm32
299 @itemx rd *= rs
300 @itemx rd *= imm32
301 32-bit arithmetic multiplication.
302
303 @item div32 rd, rs
304 @itemx div32 rd, imm32
305 @itemx rd /= rs
306 @itemx rd /= imm32
307 32-bit arithmetic integer division.
308
309 @item mod32 rd, rs
310 @itemx mod32 rd, imm32
311 @itemx rd %= rs
312 @itemx rd %= imm32
313 32-bit integer remainder.
314
315 @item and32 rd, rs
316 @itemx and32 rd, imm32
317 @itemx rd &= rs
318 @itemx rd &= imm32
319 32-bit bit-wise ``and'' operation.
320
321 @item or32 rd, rs
322 @itemx or32 rd, imm32
323 @itemx rd |= rs
324 @itemx rd |= imm32
325 32-bit bit-wise ``or'' operation.
326
327 @item xor32 rd, rs
328 @itemx xor32 rd, imm32
329 @itemx rd ^= rs
330 @itemx rd ^= imm32
331 32-bit bit-wise exclusive-or operation.
332
333 @item lsh32 rd, rs
334 @itemx lsh32 rd, imm32
335 @itemx rd <<= rs
336 @itemx rd <<= imm32
337 32-bit left shift, by @code{rs} or @code{imm32} bits.
338
339 @item rsh32 rd, rs
340 @itemx rsh32 rd, imm32
341 @itemx rd >>= rs
342 @itemx rd >>= imm32
343 32-bit right logical shift, by @code{rs} or @code{imm32} bits.
344
345 @item arsh32 rd, rs
346 @itemx arsh32 rd, imm32
347 @itemx rd s>>= rs
348 @itemx rd s>>= imm32
349 32-bit right arithmetic shift, by @code{rs} or @code{imm32} bits.
350
351 @item neg32 rd, rs
352 @itemx neg32 rd, imm32
353 @itemx rd = - rs
354 @itemx rd = - imm32
355 32-bit arithmetic negation.
356
357 Note that in the @code{rd = - imm32} syntax there must be at least
358 one white space between @code{-} and @code{imm32}. Otherwise the
359 instruction is parsed as a @code{mov32 rd, imm32} instruction with a
360 negative 32-bit immediate. This is a consequence of a syntactic
361 ambiguity in the pseudoc syntax.
362
363 @item mov32 rd, rs
364 @itemx mov32 rd, imm32
365 @itemx rd = rs
366 @itemx rd = imm32
367 Move the 32-bit value of @code{rs} in @code{rd}, or load @code{imm32}
368 in @code{rd}.
369
370 @item mov32s rd, rs, 8
371 @itemx rd s= (i8) rs
372 Move the sign-extended 8-bit value in @code{rs} to @code{rd}.
373
374 @item mov32s rd, rs, 16
375 @itemx rd s= (i16) rs
376 Move the sign-extended 16-bit value in @code{rs} to @code{rd}.
377
378 @item mov32s rd, rs, 32
379 @itemx rd s= (i32) rs
380 Move the sign-extended 32-bit value in @code{rs} to @code{rd}.
381 @end table
382
383 @subsection Endianness conversion instructions
384
385 @table @code
386 @item endle rd, 16
387 @itemx endle rd, 32
388 @itemx endle rd, 64
389 @itemx rd = le16 rd
390 @itemx rd = le32 rd
391 @itemx rd = le64 rd
392 Convert the 16-bit, 32-bit or 64-bit value in @code{rd} to
393 little-endian and store it back in @code{rd}.
394 @item endbe %d, 16
395 @itemx endbe %d, 32
396 @itemx endbe %d, 64
397 @itemx rd = be16 rd
398 @itemx rd = be32 rd
399 @itemx rd = be64 rd
400 Convert the 16-bit, 32-bit or 64-bit value in @code{rd} to big-endian
401 and store it back in @code{rd}.
402 @end table
403
404 @subsection 64-bit load and pseudo maps
405
406 @table @code
407 @item lddw rd, imm64
408 @itemx rd = imm64 ll
409 Load the given signed 64-bit immediate to the destination register
410 @code{rd}.
411 @end table
412
413 @subsection Load instructions for socket filters
414
415 The following instructions are intended to be used in socket filters,
416 and are therefore not general-purpose: they make assumptions on the
417 contents of several registers. See the file
418 @file{Documentation/networking/filter.txt} in the Linux kernel source
419 tree for more information.
420
421 Absolute loads:
422
423 @table @code
424 @item ldabsdw imm32
425 @itemx r0 = *(u64 *) skb[imm32]
426 Absolute 64-bit load.
427
428 @item ldabsw imm32
429 @itemx r0 = *(u32 *) skb[imm32]
430 Absolute 32-bit load.
431
432 @item ldabsh imm32
433 @itemx r0 = *(u16 *) skb[imm32]
434 Absolute 16-bit load.
435
436 @item ldabsb imm32
437 @itemx r0 = *(u8 *) skb[imm32]
438 Absolute 8-bit load.
439 @end table
440
441 Indirect loads:
442
443 @table @code
444 @item ldinddw rs, imm32
445 @itemx r0 = *(u64 *) skb[rs + imm32]
446 Indirect 64-bit load.
447
448 @item ldindw rs, imm32
449 @itemx r0 = *(u32 *) skb[rs + imm32]
450 Indirect 32-bit load.
451
452 @item ldindh rs, imm32
453 @itemx r0 = *(u16 *) skb[rs + imm32]
454 Indirect 16-bit load.
455
456 @item ldindb %s, imm32
457 @itemx r0 = *(u8 *) skb[rs + imm32]
458 Indirect 8-bit load.
459 @end table
460
461 @subsection Generic load/store instructions
462
463 General-purpose load and store instructions are provided for several
464 word sizes.
465
466 Load to register instructions:
467
468 @table @code
469 @item ldxdw rd, [rs + offset16]
470 @itemx rd = *(u64 *) (rs + offset16)
471 Generic 64-bit load.
472
473 @item ldxw rd, [rs + offset16]
474 @itemx rd = *(u32 *) (rs + offset16)
475 Generic 32-bit load.
476
477 @item ldxh rd, [rs + offset16]
478 @itemx rd = *(u16 *) (rs + offset16)
479 Generic 16-bit load.
480
481 @item ldxb rd, [rs + offset16]
482 @itemx rd = *(u8 *) (rs + offset16)
483 Generic 8-bit load.
484 @end table
485
486 Store from register instructions:
487
488 @table @code
489 @item stxdw [rd + offset16], %s
490 @itemx *(u64 *) (rd + offset16)
491 Generic 64-bit store.
492
493 @item stxw [rd + offset16], %s
494 @itemx *(u32 *) (rd + offset16)
495 Generic 32-bit store.
496
497 @item stxh [rd + offset16], %s
498 @itemx *(u16 *) (rd + offset16)
499 Generic 16-bit store.
500
501 @item stxb [rd + offset16], %s
502 @itemx *(u8 *) (rd + offset16)
503 Generic 8-bit store.
504 @end table
505
506 Store from immediates instructions:
507
508 @table @code
509 @item stdw [rd + offset16], imm32
510 @itemx *(u64 *) (rd + offset16) = imm32
511 Store immediate as 64-bit.
512
513 @item stw [rd + offset16], imm32
514 @itemx *(u32 *) (rd + offset16) = imm32
515 Store immediate as 32-bit.
516
517 @item sth [rd + offset16], imm32
518 @itemx *(u16 *) (rd + offset16) = imm32
519 Store immediate as 16-bit.
520
521 @item stb [rd + offset16], imm32
522 @itemx *(u8 *) (rd + offset16) = imm32
523 Store immediate as 8-bit.
524 @end table
525
526 @subsection Jump instructions
527
528 eBPF provides the following compare-and-jump instructions, which
529 compare the values of the two given registers, or the values of a
530 register and an immediate, and perform a branch in case the comparison
531 holds true.
532
533 @table @code
534 @item ja disp16
535 @itemx goto disp16
536 Jump-always.
537
538 @item jeq rd, rs, disp16
539 @itemx jeq rd, imm32, disp16
540 @itemx if rd == rs goto disp16
541 @itemx if rd == imm32 goto disp16
542 Jump if equal, unsigned.
543
544 @item jgt rd, rs, disp16
545 @itemx jgt rd, imm32, disp16
546 @itemx if rd > rs goto disp16
547 @itemx if rd > imm32 goto disp16
548 Jump if greater, unsigned.
549
550 @item jge rd, rs, disp16
551 @itemx jge rd, imm32, disp16
552 @itemx if rd >= rs goto disp16
553 @itemx if rd >= imm32 goto disp16
554 Jump if greater or equal.
555
556 @item jlt rd, rs, disp16
557 @itemx jlt rd, imm32, disp16
558 @itemx if rd < rs goto disp16
559 @itemx if rd < imm32 goto disp16
560 Jump if lesser.
561
562 @item jle rd , rs, disp16
563 @itemx jle rd, imm32, disp16
564 @itemx if rd <= rs goto disp16
565 @itemx if rd <= imm32 goto disp16
566 Jump if lesser or equal.
567
568 @item jset rd, rs, disp16
569 @itemx jset rd, imm32, disp16
570 @itemx if rd & rs goto disp16
571 @itemx if rd & imm32 goto disp16
572 Jump if signed equal.
573
574 @item jne rd, rs, disp16
575 @itemx jne rd, imm32, disp16
576 @itemx if rd != rs goto disp16
577 @itemx if rd != imm32 goto disp16
578 Jump if not equal.
579
580 @item jsgt rd, rs, disp16
581 @itemx jsgt rd, imm32, disp16
582 @itemx if rd s> rs goto disp16
583 @itemx if rd s> imm32 goto disp16
584 Jump if signed greater.
585
586 @item jsge rd, rs, disp16
587 @itemx jsge rd, imm32, disp16
588 @itemx if rd s>= rd goto disp16
589 @itemx if rd s>= imm32 goto disp16
590 Jump if signed greater or equal.
591
592 @item jslt rd, rs, disp16
593 @itemx jslt rd, imm32, disp16
594 @itemx if rd s< rs goto disp16
595 @itemx if rd s< imm32 goto disp16
596 Jump if signed lesser.
597
598 @item jsle rd, rs, disp16
599 @itemx jsle rd, imm32, disp16
600 @itemx if rd s<= rs goto disp16
601 @itemx if rd s<= imm32 goto disp16
602 Jump if signed lesser or equal.
603 @end table
604
605 A call instruction is provided in order to perform calls to other eBPF
606 functions, or to external kernel helpers:
607
608 @table @code
609 @item call disp32
610 @item call imm32
611 Jump and link to the offset @emph{disp32}, or to the kernel helper
612 function identified by @emph{imm32}.
613 @end table
614
615 Finally:
616
617 @table @code
618 @item exit
619 Terminate the eBPF program.
620 @end table
621
622 @subsection 32-bit jump instructions
623
624 eBPF provides the following compare-and-jump instructions, which
625 compare the 32-bit values of the two given registers, or the values of
626 a register and an immediate, and perform a branch in case the
627 comparison holds true.
628
629 These instructions are only available in BPF v3 or later.
630
631 @table @code
632 @item jeq32 rd, rs, disp16
633 @itemx jeq32 rd, imm32, disp16
634 @itemx if rd == rs goto disp16
635 @itemx if rd == imm32 goto disp16
636 Jump if equal, unsigned.
637
638 @item jgt32 rd, rs, disp16
639 @itemx jgt32 rd, imm32, disp16
640 @itemx if rd > rs goto disp16
641 @itemx if rd > imm32 goto disp16
642 Jump if greater, unsigned.
643
644 @item jge32 rd, rs, disp16
645 @itemx jge32 rd, imm32, disp16
646 @itemx if rd >= rs goto disp16
647 @itemx if rd >= imm32 goto disp16
648 Jump if greater or equal.
649
650 @item jlt32 rd, rs, disp16
651 @itemx jlt32 rd, imm32, disp16
652 @itemx if rd < rs goto disp16
653 @itemx if rd < imm32 goto disp16
654 Jump if lesser.
655
656 @item jle32 rd , rs, disp16
657 @itemx jle32 rd, imm32, disp16
658 @itemx if rd <= rs goto disp16
659 @itemx if rd <= imm32 goto disp16
660 Jump if lesser or equal.
661
662 @item jset32 rd, rs, disp16
663 @itemx jset32 rd, imm32, disp16
664 @itemx if rd & rs goto disp16
665 @itemx if rd & imm32 goto disp16
666 Jump if signed equal.
667
668 @item jne32 rd, rs, disp16
669 @itemx jne32 rd, imm32, disp16
670 @itemx if rd != rs goto disp16
671 @itemx if rd != imm32 goto disp16
672 Jump if not equal.
673
674 @item jsgt32 rd, rs, disp16
675 @itemx jsgt32 rd, imm32, disp16
676 @itemx if rd s> rs goto disp16
677 @itemx if rd s> imm32 goto disp16
678 Jump if signed greater.
679
680 @item jsge32 rd, rs, disp16
681 @itemx jsge32 rd, imm32, disp16
682 @itemx if rd s>= rd goto disp16
683 @itemx if rd s>= imm32 goto disp16
684 Jump if signed greater or equal.
685
686 @item jslt32 rd, rs, disp16
687 @itemx jslt32 rd, imm32, disp16
688 @itemx if rd s< rs goto disp16
689 @itemx if rd s< imm32 goto disp16
690 Jump if signed lesser.
691
692 @item jsle32 rd, rs, disp16
693 @itemx jsle32 rd, imm32, disp16
694 @itemx if rd s<= rs goto disp16
695 @itemx if rd s<= imm32 goto disp16
696 Jump if signed lesser or equal.
697 @end table
698
699 @subsection Atomic instructions
700
701 Atomic exchange-and-add instructions are provided in two flavors: one
702 for swapping 64-bit quantities and another for 32-bit quantities.
703
704 @table @code
705 @item aadd [rd + offset16], rs
706 @itemx *(u64 *)(rd + offset16) = rs
707 Atomic add instruction.
708
709 @item aor [rd + offset16], rs
710 @itemx *(u64 *) (rd + offset16) |= rs
711 Atomic or instruction.
712
713 @item aand [rd + offset16], rs
714 @itemx *(u64 *) (rd + offset16) &= rs
715 Atomic and instruction.
716
717 @item axor [rd + offset16], rs
718 @itemx *(u64 *) (rd + offset16) ^= rs
719 Atomic xor instruction
720 @item xaddw [%d+offset16],%s
721 Exchange-and-add a 32-bit value at the specified location.
722 @end table
723
724 @noindent
725 The following variants perform fetching before the atomic operation.
726
727 @table @code
728 @item afadd [dr + offset16], rs
729 @itemx ???
730 Atomic fetch-and-add instruction.
731
732 @item afor [dr + offset16], rs
733 @itemx ???
734 Atomic fetch-and-or instruction.
735
736 @item afand [dr + offset16], rs
737 @itemx ???
738 Atomic fetch-and-and instruction.
739
740 @item afxor [dr + offset16], rs
741 @itemx ???
742 Atomic fetch-and-or instruction
743 @end table
744
745 The above instructions were introduced in the V3 of the BPF
746 instruction set. The following instruction is supported for backwards
747 compatibility:
748
749 @table @code
750 @item xadddw [rd + offset16], rs
751 Alias to @code{aadd}.
752 @end table
753
754 @subsection 32-bit atomic instructions
755
756 Atomic exchange-and-add instructions are provided in two flavors: one
757 for swapping 32-bit quantities and another for 32-bit quantities.
758
759 @table @code
760 @item aadd32 [rd + offset16], rs
761 @itemx *(u32 *)(rd + offset16) = rs
762 Atomic add instruction.
763
764 @item aor32 [rd + offset16], rs
765 @itemx *(u32 *) (rd + offset16) |= rs
766 Atomic or instruction.
767
768 @item aand32 [rd + offset16], rs
769 @itemx *(u32 *) (rd + offset16) &= rs
770 Atomic and instruction.
771
772 @item axor32 [rd + offset16], rs
773 @itemx *(u32 *) (rd + offset16) ^= rs
774 Atomic xor instruction
775 @end table
776
777 @noindent
778 The following variants perform fetching before the atomic operation.
779
780 @table @code
781 @item afadd32 [dr + offset16], rs
782 @itemx ???
783 Atomic fetch-and-add instruction.
784
785 @item afor32 [dr + offset16], rs
786 @itemx ???
787 Atomic fetch-and-or instruction.
788
789 @item afand32 [dr + offset16], rs
790 @itemx ???
791 Atomic fetch-and-and instruction.
792
793 @item afxor32 [dr + offset16], rs
794 @itemx ???
795 Atomic fetch-and-or instruction
796 @end table
797
798 The above instructions were introduced in the V3 of the BPF
799 instruction set. The following instruction is supported for backwards
800 compatibility:
801
802 @table @code
803 @item xaddw [rd + offset16], rs
804 Alias to @code{aadd32}.
805 @end table