#[repr(u8)]pub enum Register {
R0 = 0,
R1 = 1,
R2 = 2,
R3 = 3,
R4 = 4,
R5 = 5,
R6 = 6,
R7 = 7,
R8 = 8,
R9 = 9,
R10 = 10,
}
Expand description
§eBPF Registers
Quoting the kernel documentation on eBPF registers:
eBPF has 10 general purpose registers and a read-only frame pointer register, all of which are 64-bits wide.
The eBPF calling convention is defined as:
R0
: return value from function calls, and exit value for eBPF programs
R1
-R5
: arguments for function calls
R6
-R9
: callee saved registers that function calls will preserve
R10
: read-only frame pointer to access stack
R0
-R5
are scratch registers and eBPF programs needs to spill/fill them if necessary across calls.
Source: kernel tree
Variants§
R0 = 0
Usually used as either the return value in function calls or as the exit value in programs
R1 = 1
R2 = 2
R3 = 3
R4 = 4
R5 = 5
R6 = 6
R7 = 7
R8 = 8
R9 = 9
R10 = 10
Read-only frame pointer register
Trait Implementations§
Source§impl TryFromPrimitive for Register
impl TryFromPrimitive for Register
impl Copy for Register
impl Eq for Register
impl StructuralPartialEq for Register
Auto Trait Implementations§
impl Freeze for Register
impl RefUnwindSafe for Register
impl Send for Register
impl Sync for Register
impl Unpin for Register
impl UnwindSafe for Register
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more