Lines Matching +full:a +full:- +full:bit

14 of types using a shorthand syntax and refers to several expository,
20 -----
22 a type's signedness (`S`) and bit width (`N`), respectively.
33 .. table:: Meaning of bit-width notation.
36 `N` Bit width
45 For example, `u32` is a type whose valid values are all the 32-bit unsigned
46 numbers and `s16` is a types whose valid values are all the 16-bit signed
50 ---------
51 * `htobe16`: Takes an unsigned 16-bit number in host-endian format and
52 returns the equivalent number as an unsigned 16-bit number in big-endian
54 * `htobe32`: Takes an unsigned 32-bit number in host-endian format and
55 returns the equivalent number as an unsigned 32-bit number in big-endian
57 * `htobe64`: Takes an unsigned 64-bit number in host-endian format and
58 returns the equivalent number as an unsigned 64-bit number in big-endian
60 * `htole16`: Takes an unsigned 16-bit number in host-endian format and
61 returns the equivalent number as an unsigned 16-bit number in little-endian
63 * `htole32`: Takes an unsigned 32-bit number in host-endian format and
64 returns the equivalent number as an unsigned 32-bit number in little-endian
66 * `htole64`: Takes an unsigned 64-bit number in host-endian format and
67 returns the equivalent number as an unsigned 64-bit number in little-endian
69 * `bswap16`: Takes an unsigned 16-bit number in either big- or little-endian
70 format and returns the equivalent number with the same bit width but
72 * `bswap32`: Takes an unsigned 32-bit number in either big- or little-endian
73 format and returns the equivalent number with the same bit width but
75 * `bswap64`: Takes an unsigned 64-bit number in either big- or little-endian
76 format and returns the equivalent number with the same bit width but
81 -----------
86 To `sign extend an` ``X`` `-bit number, A, to a` ``Y`` `-bit number, B ,` means to
88 #. Copy all ``X`` bits from `A` to the lower ``X`` bits of `B`.
89 #. Set the value of the remaining ``Y`` - ``X`` bits of `B` to the value of
90 the most-significant bit of `A`.
94 Sign extend an 8-bit number ``A`` to a 16-bit number ``B`` on a big-endian platform:
97 A: 10000110
106 * the wide instruction encoding, which appends a second 64-bit immediate (i.e.,
107 constant) value after the basic instruction for a total of 128 bits.
112 opcode:8 src_reg:4 dst_reg:4 offset:16 imm:32 // In little-endian BPF.
113 opcode:8 dst_reg:4 src_reg:4 offset:16 imm:32 // In big-endian BPF.
122 the source register number (0-10), except where otherwise specified
123 (`64-bit immediate instructions`_ reuse this field for other purposes)
126 destination register number (0-10)
131 Note that the contents of multi-byte fields ('imm' and 'offset') are
132 stored using big-endian byte ordering in big-endian BPF and
133 little-endian byte ordering in little-endian BPF.
146 As discussed below in `64-bit immediate instructions`_, a 64-bit immediate
147 instruction uses a 64-bit immediate value that is constructed as follows.
148 The 64 bits following the basic instruction contain a pseudo instruction
155 .-----------------------------.
159 '--------------'
162 Thus the 64-bit immediate value is constructed as follows:
171 -------------------
178 BPF_LD 0x00 non-standard load operations `Load and store instructions`_
182 BPF_ALU 0x04 32-bit arithmetic operations `Arithmetic and jump instructions`_
183 BPF_JMP 0x05 64-bit jump operations `Arithmetic and jump instructions`_
184 BPF_JMP32 0x06 32-bit jump operations `Arithmetic and jump instructions`_
185 BPF_ALU64 0x07 64-bit arithmetic operations `Arithmetic and jump instructions`_
192 ``BPF_JMP32``), the 8-bit 'opcode' field is divided into three parts:
195 4 bits (MSB) 1 bit 3 bits (LSB)
209 BPF_K 0x00 use 32-bit 'imm' value as source operand
217 -----------------------
219 ``BPF_ALU`` uses 32-bit wide operands while ``BPF_ALU64`` uses 64-bit wide operands for
228 BPF_SUB 0x10 0 dst -= src
236 BPF_NEG 0x80 0 dst = -dst
247 the 64-bit or 32-bit value will wrap. If BPF program execution would
272 (``BPF_SDIV``, ``BPF_SMOD``, ``BPF_MOVSX``) have a non-zero offset.
277 'imm' is interpreted as a 32-bit unsigned value. For ``BPF_ALU64``,
279 interpreted as a 64-bit unsigned value.
282 'imm' is interpreted as a 32-bit signed value. For ``BPF_ALU64``, 'imm'
284 interpreted as a 64-bit signed value.
290 (where -13 % 3 == -1) as implemented in C, Go, etc.:
292 a % n = a - n * trunc(a / n)
294 The ``BPF_MOVSX`` instruction does a move operation with sign extension.
295 ``BPF_ALU | BPF_MOVSX`` :term:`sign extends<Sign Extend>` 8-bit and 16-bit operands into 32
296 bit operands, and zeroes the remaining upper 32 bits.
297 ``BPF_ALU64 | BPF_MOVSX`` :term:`sign extends<Sign Extend>` 8-bit, 16-bit, and 32-bit
298 operands into 64 bit operands.
300 Shift operations use a mask of 0x3F (63) for 64-bit operations and 0x1F (31)
301 for 32-bit operations.
304 ----------------------
307 and a 4-bit 'code' field of ``BPF_END``.
310 only and do not use a separate source register or immediate value.
312 For ``BPF_ALU``, the 1-bit source operand field in the opcode is used to
314 ``BPF_ALU64``, the 1-bit source operand field in the opcode is reserved
349 -----------------
351 ``BPF_JMP32`` uses 32-bit wide operands while ``BPF_JMP`` uses 64-bit wide operands for
368 BPF_CALL 0x8 0x1 call PC += imm see `Program-local functions`_
377 The BPF program needs to store the return value into register R0 before doing a
386 where 's>=' indicates a signed '>=' comparison.
395 ``BPF_JMP`` class permits a 16-bit jump offset specified by the 'offset'
396 field, whereas the ``BPF_JMP32`` class permits a 32-bit jump offset
397 specified by the 'imm' field. A > 16-bit conditional jump may be
398 converted to a < 16-bit conditional jump plus a 32-bit unconditional
404 Helper functions are a concept whereby BPF programs can call into a
412 a helper function by a BTF ID encoded in the imm field, where the BTF ID
415 Program-local functions
417 Program-local functions are functions exposed by the same BPF program as the
420 A ``BPF_EXIT`` within the program-local function will return to the caller.
426 8-bit 'opcode' field is divided as:
439 BPF_IMM 0x00 64-bit immediate instructions `64-bit immediate instructions`_
443 BPF_MEMSX 0x80 sign-extension load operations `Sign-extension load operations`_
459 ---------------------------------
462 instructions that transfer data between a register and memory.
479 Sign-extension load operations
480 ------------------------------
482 The ``BPF_MEMSX`` mode modifier is used to encode :term:`sign-extension<Sign Extend>` load
483 instructions that transfer data between a register and memory.
493 -----------------
502 * ``BPF_ATOMIC | BPF_W | BPF_STX`` for 32-bit operations
503 * ``BPF_ATOMIC | BPF_DW | BPF_STX`` for 64-bit operations
504 * 8-bit and 16-bit wide atomic operations are not supported.
507 Simple atomic operation use a subset of the values defined to encode
528 In addition to the simple atomic operations, there also is a modifier and
550 value that was at ``dst + offset`` before the operation is zero-extended
553 64-bit immediate instructions
554 -----------------------------
560 The following table defines a set of ``BPF_IMM | BPF_DW | BPF_LD`` instructions
578 * map_by_fd(imm) means to convert a 32-bit file descriptor into an address of a map (see `Maps`_)
579 * map_by_idx(imm) means to convert a 32-bit index into an address of a map
580 * map_val(map) gets the address of the first value in a given map
581 * var_addr(imm) gets the address of a platform variable (see `Platform Variables`_) with a given id
582 …de_addr(imm) gets the address of the instruction at a specified relative offset in number of (64-b…
590 A map can have various semantics as defined in a separate document, and may or
591 may not have a single contiguous memory region, but the 'map_val(map)' is
592 currently only defined for maps that do have a single contiguous memory region.
594 Each map can have a file descriptor (fd) if supported by the platform, where
596 BPF program can also be defined to use a set of maps associated with the
609 -------------------------------------