9.7.3 BPF Registers

The eBPF processor provides ten general-purpose 64-bit registers, which are read-write, and a read-only frame pointer register:

In normal syntax:

%r0 .. %r9

General-purpose registers.

%r10
%fp

Read-only frame pointer register.

All BPF registers are 64-bit long. However, in the Pseudo-C syntax registers can be referred using different names, which actually reflect the kind of instruction they appear on:

In pseudoc syntax:

r0..r9

General-purpose register in an instruction that operates on its value as if it was a 64-bit value.

w0..w9

General-purpose register in an instruction that operates on its value as if it was a 32-bit value.

r10

Read-only frame pointer register.

Note that in the Pseudo-C syntax register names are not preceded by % characters. A consequence of that is that in contexts like instruction operands, where both register names and expressions involving symbols are expected, there is no way to disambiguate between them. In order to keep things simple, this assembler does not allow to refer to symbols whose names collide with register names in instruction operands.