Liking cljdoc? Tell your friends :D

clj-ebpf.dsl.alu

ALU (Arithmetic Logic Unit) operations for BPF programs.

Provides 32-bit and 64-bit arithmetic operations:

  • Arithmetic: add, sub, mul, div, mod, neg
  • Bitwise: and, or, xor, lsh, rsh, arsh
  • Data movement: mov
  • Endianness conversion: end-to-be, end-to-le
ALU (Arithmetic Logic Unit) operations for BPF programs.

Provides 32-bit and 64-bit arithmetic operations:
- Arithmetic: add, sub, mul, div, mod, neg
- Bitwise: and, or, xor, lsh, rsh, arsh
- Data movement: mov
- Endianness conversion: end-to-be, end-to-le
raw docstring

addclj

(add dst imm)

Add immediate to register.

dst += imm

Add immediate to register.

dst += imm
sourceraw docstring

add-regclj

(add-reg dst src)

Add register to register.

dst += src

Add register to register.

dst += src
sourceraw docstring

add32clj

(add32 dst imm)

Add immediate to register (32-bit).

(u32)dst += imm

Add immediate to register (32-bit).

(u32)dst += imm
sourceraw docstring

add32-regclj

(add32-reg dst src)

Add register to register (32-bit).

(u32)dst += (u32)src

Add register to register (32-bit).

(u32)dst += (u32)src
sourceraw docstring

alu-opsclj

Map of ALU operation keywords to BPF opcodes

Map of ALU operation keywords to BPF opcodes
sourceraw docstring

alu32-immclj

(alu32-imm op dst imm)

32-bit ALU operation with immediate source.

(u32)dst = (u32)dst OP imm

Arguments:

  • op: Operation keyword (:add, :sub, :mul, etc.)
  • dst: Destination register
  • imm: Immediate value (32-bit)
32-bit ALU operation with immediate source.

(u32)dst = (u32)dst OP imm

Arguments:
- op: Operation keyword (:add, :sub, :mul, etc.)
- dst: Destination register
- imm: Immediate value (32-bit)
sourceraw docstring

alu32-regclj

(alu32-reg op dst src)

32-bit ALU operation with register source.

(u32)dst = (u32)dst OP (u32)src

Arguments:

  • op: Operation keyword (:add, :sub, :mul, etc.)
  • dst: Destination register
  • src: Source register
32-bit ALU operation with register source.

(u32)dst = (u32)dst OP (u32)src

Arguments:
- op: Operation keyword (:add, :sub, :mul, etc.)
- dst: Destination register
- src: Source register
sourceraw docstring

alu64-immclj

(alu64-imm op dst imm)

64-bit ALU operation with immediate source.

dst = dst OP imm

Arguments:

  • op: Operation keyword (:add, :sub, :mul, etc.)
  • dst: Destination register
  • imm: Immediate value (32-bit)
64-bit ALU operation with immediate source.

dst = dst OP imm

Arguments:
- op: Operation keyword (:add, :sub, :mul, etc.)
- dst: Destination register
- imm: Immediate value (32-bit)
sourceraw docstring

alu64-regclj

(alu64-reg op dst src)

64-bit ALU operation with register source.

dst = dst OP src

Arguments:

  • op: Operation keyword (:add, :sub, :mul, etc.)
  • dst: Destination register
  • src: Source register
64-bit ALU operation with register source.

dst = dst OP src

Arguments:
- op: Operation keyword (:add, :sub, :mul, etc.)
- dst: Destination register
- src: Source register
sourceraw docstring

and-opclj

(and-op dst imm)

Bitwise AND register with immediate.

dst &= imm

Bitwise AND register with immediate.

dst &= imm
sourceraw docstring

and-regclj

(and-reg dst src)

Bitwise AND register with register.

dst &= src

Bitwise AND register with register.

dst &= src
sourceraw docstring

arshclj

(arsh dst imm)

Arithmetic right shift by immediate.

dst >>>= imm (preserving sign)

Arithmetic right shift by immediate.

dst >>>= imm (preserving sign)
sourceraw docstring

arsh-regclj

(arsh-reg dst src)

Arithmetic right shift by register.

dst >>>= src (preserving sign)

Arithmetic right shift by register.

dst >>>= src (preserving sign)
sourceraw docstring

bswap16clj

(bswap16 dst)

Byte swap 16-bit value (big-endian to little-endian or vice versa).

Byte swap 16-bit value (big-endian to little-endian or vice versa).
sourceraw docstring

bswap32clj

(bswap32 dst)

Byte swap 32-bit value.

Byte swap 32-bit value.
sourceraw docstring

bswap64clj

(bswap64 dst)

Byte swap 64-bit value.

Byte swap 64-bit value.
sourceraw docstring

divclj

(div dst imm)

Divide register by immediate.

dst /= imm

Divide register by immediate.

dst /= imm
sourceraw docstring

div-regclj

(div-reg dst src)

Divide register by register.

dst /= src

Divide register by register.

dst /= src
sourceraw docstring

end-to-beclj

(end-to-be dst size)

Convert register to big-endian.

Arguments:

  • dst: Register to convert
  • size: Size in bits (16, 32, or 64)
Convert register to big-endian.

Arguments:
- dst: Register to convert
- size: Size in bits (16, 32, or 64)
sourceraw docstring

end-to-leclj

(end-to-le dst size)

Convert register to little-endian.

Arguments:

  • dst: Register to convert
  • size: Size in bits (16, 32, or 64)
Convert register to little-endian.

Arguments:
- dst: Register to convert
- size: Size in bits (16, 32, or 64)
sourceraw docstring

lshclj

(lsh dst imm)

Left shift register by immediate.

dst <<= imm

Left shift register by immediate.

dst <<= imm
sourceraw docstring

lsh-regclj

(lsh-reg dst src)

Left shift register by register.

dst <<= src

Left shift register by register.

dst <<= src
sourceraw docstring

mod-opclj

(mod-op dst imm)

Modulo register by immediate.

dst %= imm

Modulo register by immediate.

dst %= imm
sourceraw docstring

mod-regclj

(mod-reg dst src)

Modulo register by register.

dst %= src

Modulo register by register.

dst %= src
sourceraw docstring

movclj

(mov dst imm)

Move immediate to register (64-bit).

dst = imm

Arguments:

  • dst: Destination register
  • imm: Immediate value (32-bit, sign-extended to 64-bit)
Move immediate to register (64-bit).

dst = imm

Arguments:
- dst: Destination register
- imm: Immediate value (32-bit, sign-extended to 64-bit)
sourceraw docstring

mov-regclj

(mov-reg dst src)

Move register to register (64-bit).

dst = src

Arguments:

  • dst: Destination register
  • src: Source register
Move register to register (64-bit).

dst = src

Arguments:
- dst: Destination register
- src: Source register
sourceraw docstring

mov32clj

(mov32 dst imm)

Move immediate to register (32-bit).

(u32)dst = imm

Arguments:

  • dst: Destination register
  • imm: Immediate value (32-bit)
Move immediate to register (32-bit).

(u32)dst = imm

Arguments:
- dst: Destination register
- imm: Immediate value (32-bit)
sourceraw docstring

mov32-regclj

(mov32-reg dst src)

Move register to register (32-bit).

(u32)dst = (u32)src

Arguments:

  • dst: Destination register
  • src: Source register
Move register to register (32-bit).

(u32)dst = (u32)src

Arguments:
- dst: Destination register
- src: Source register
sourceraw docstring

mulclj

(mul dst imm)

Multiply register by immediate.

dst *= imm

Multiply register by immediate.

dst *= imm
sourceraw docstring

mul-regclj

(mul-reg dst src)

Multiply register by register.

dst *= src

Multiply register by register.

dst *= src
sourceraw docstring

neg-regclj

(neg-reg dst)

Negate register.

dst = -dst

Negate register.

dst = -dst
sourceraw docstring

or-opclj

(or-op dst imm)

Bitwise OR register with immediate.

dst |= imm

Bitwise OR register with immediate.

dst |= imm
sourceraw docstring

or-regclj

(or-reg dst src)

Bitwise OR register with register.

dst |= src

Bitwise OR register with register.

dst |= src
sourceraw docstring

rshclj

(rsh dst imm)

Right shift register by immediate (logical).

dst >>= imm

Right shift register by immediate (logical).

dst >>= imm
sourceraw docstring

rsh-regclj

(rsh-reg dst src)

Right shift register by register (logical).

dst >>= src

Right shift register by register (logical).

dst >>= src
sourceraw docstring

subclj

(sub dst imm)

Subtract immediate from register.

dst -= imm

Subtract immediate from register.

dst -= imm
sourceraw docstring

sub-regclj

(sub-reg dst src)

Subtract register from register.

dst -= src

Subtract register from register.

dst -= src
sourceraw docstring

sub32clj

(sub32 dst imm)

Subtract immediate from register (32-bit).

(u32)dst -= imm

Subtract immediate from register (32-bit).

(u32)dst -= imm
sourceraw docstring

sub32-regclj

(sub32-reg dst src)

Subtract register from register (32-bit).

(u32)dst -= (u32)src

Subtract register from register (32-bit).

(u32)dst -= (u32)src
sourceraw docstring

xor-opclj

(xor-op dst imm)

Bitwise XOR register with immediate.

dst ^= imm

Bitwise XOR register with immediate.

dst ^= imm
sourceraw docstring

xor-regclj

(xor-reg dst src)

Bitwise XOR register with register.

dst ^= src

Bitwise XOR register with register.

dst ^= src
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close