-
Notifications
You must be signed in to change notification settings - Fork 0
eBPF opcodes
Alex Petrov edited this page Nov 20, 2024
·
3 revisions
Load and Store:
LD_ABS (0x20): Load from a packet at an offset.
LD_IND (0x28): Load from a packet at a dynamic offset.
LDX (0x61): Load a value from memory into a register.
STX (0x63): Store a register's value into memory.
Arithmetic Operations:
ADD (0x07): Add two values.
SUB (0x1f): Subtract one value from another.
MUL (0x27): Multiply two values.
DIV (0x37): Divide one value by another.
MOD (0x47): Modulo operation.
NEG (0x87): Negate a value.
Bitwise Operations:
AND (0x57): Perform a bitwise AND.
OR (0x67): Perform a bitwise OR.
XOR (0x77): Perform a bitwise XOR.
LSH (0x87): Left shift.
RSH (0x97): Right shift.
Control Flow:
JA (0x05): Jump unconditionally.
JEQ (0x15): Jump if equal.
JNE (0x25): Jump if not equal.
JGT (0x35): Jump if greater than.
JLT (0x45): Jump if less than.
JSET (0x55): Jump if bitwise AND is non-zero.
Call and Return:
CALL (0x85): Call a helper function.
EXIT (0x95): Exit the eBPF program.
Special Instructions:
MOV (0xb7): Move a value to a register.
XADD (0xc3): Atomic add.