Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Inline Assembly

The asm form emits a single raw BPF instruction. It is an escape hatch for cases where Whistler does not yet have a dedicated form for a particular BPF operation.

Syntax

(asm opcode dst-reg src-reg offset immediate)

All arguments are integer constants corresponding to BPF instruction fields:

FieldSizeDescription
opcode8-bitBPF opcode (e.g., #x85 for call)
dst-reg4-bitDestination register (0--10)
src-reg4-bitSource register (0--10)
offset16-bit signedOffset field
immediate32-bit signedImmediate value

Example

;; Emit a raw BPF_CALL instruction for helper #5 (ktime_get_ns)
(asm #x85 0 0 0 5)

Use this sparingly. Prefer Whistler's typed forms (load, store, helper calls by name) whenever possible -- they provide type safety, register allocation, and verifier-friendly patterns that raw assembly does not.