Lines Matching +full:32 +full:- +full:bit
20 -----
22 a type's signedness (`S`) and bit width (`N`), respectively.
33 .. table:: Meaning of bit-width notation.
36 `N` Bit width
40 `32` 32 bits
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
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:
106 * the wide instruction encoding, which appends a second 64-bit immediate (i.e.,
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.
150 and imm containing the high 32 bits of the immediate value.
155 .-----------------------------.
157 code:8 regs:8 offset:16 imm:32 unused:32 imm:32
159 '--------------'
162 Thus the 64-bit immediate value is constructed as follows:
164 imm64 = (next_imm << 32) | imm
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
241 BPF_MOVSX 0xb0 8/16/32 dst = (s8,s16,s32)src
247 the 64-bit or 32-bit value will wrap. If BPF program execution would
251 32 bits of the destination register are zeroed.
257 where '(u32)' indicates that the upper 32 bits are zeroed.
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``,
278 'imm' is first :term:`sign extended<Sign Extend>` from 32 to 64 bits, and then
279 interpreted as a 64-bit unsigned value.
282 'imm' is interpreted as a 32-bit signed value. For ``BPF_ALU64``, 'imm'
283 is first :term:`sign extended<Sign Extend>` from 32 to 64 bits, and then
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)
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``.
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
326 are supported: 16, 32 and 64.
330 ``BPF_ALU | BPF_TO_LE | BPF_END`` with imm = 16/32/64 means::
336 ``BPF_ALU | BPF_TO_BE | BPF_END`` with imm = 16/32/64 means::
342 ``BPF_ALU64 | BPF_TO_LE | BPF_END`` with imm = 16/32/64 means::
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`_
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
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 ---------------------------------
479 Sign-extension load operations
480 ------------------------------
482 The ``BPF_MEMSX`` mode modifier is used to encode :term:`sign-extension<Sign Extend>` load
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.
550 value that was at ``dst + offset`` before the operation is zero-extended
553 64-bit immediate instructions
554 -----------------------------
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
582 …ts the address of the instruction at a specified relative offset in number of (64-bit) instructions
609 -------------------------------------