@@ -171,34 +171,6 @@ BPF_MEM | <size> | BPF_LDX means::
171171
172172Where size is one of: BPF_B or BPF_H or BPF_W or BPF_DW.
173173
174- Packet access instructions
175- --------------------------
176-
177- eBPF has two non-generic instructions: (BPF_ABS | <size> | BPF_LD) and
178- (BPF_IND | <size> | BPF_LD) which are used to access packet data.
179-
180- They had to be carried over from classic BPF to have strong performance of
181- socket filters running in eBPF interpreter. These instructions can only
182- be used when interpreter context is a pointer to ``struct sk_buff `` and
183- have seven implicit operands. Register R6 is an implicit input that must
184- contain pointer to sk_buff. Register R0 is an implicit output which contains
185- the data fetched from the packet. Registers R1-R5 are scratch registers
186- and must not be used to store the data across BPF_ABS | BPF_LD or
187- BPF_IND | BPF_LD instructions.
188-
189- These instructions have implicit program exit condition as well. When
190- eBPF program is trying to access the data beyond the packet boundary,
191- the interpreter will abort the execution of the program. JIT compilers
192- therefore must preserve this property. src_reg and imm32 fields are
193- explicit inputs to these instructions.
194-
195- For example::
196-
197- BPF_IND | BPF_W | BPF_LD means:
198-
199- R0 = ntohl(*(u32 *) (((struct sk_buff *) R6)->data + src_reg + imm32))
200- and R1 - R5 were scratched.
201-
202174Atomic operations
203175-----------------
204176
@@ -252,3 +224,30 @@ zero.
252224eBPF has one 16-byte instruction: ``BPF_LD | BPF_DW | BPF_IMM `` which consists
253225of two consecutive ``struct bpf_insn `` 8-byte blocks and interpreted as single
254226instruction that loads 64-bit immediate value into a dst_reg.
227+
228+ Packet access instructions
229+ --------------------------
230+
231+ eBPF has two non-generic instructions: (BPF_ABS | <size> | BPF_LD) and
232+ (BPF_IND | <size> | BPF_LD) which are used to access packet data.
233+
234+ They had to be carried over from classic BPF to have strong performance of
235+ socket filters running in eBPF interpreter. These instructions can only
236+ be used when interpreter context is a pointer to ``struct sk_buff `` and
237+ have seven implicit operands. Register R6 is an implicit input that must
238+ contain pointer to sk_buff. Register R0 is an implicit output which contains
239+ the data fetched from the packet. Registers R1-R5 are scratch registers
240+ and must not be used to store the data across BPF_ABS | BPF_LD or
241+ BPF_IND | BPF_LD instructions.
242+
243+ These instructions have implicit program exit condition as well. When
244+ eBPF program is trying to access the data beyond the packet boundary,
245+ the interpreter will abort the execution of the program. JIT compilers
246+ therefore must preserve this property. src_reg and imm32 fields are
247+ explicit inputs to these instructions.
248+
249+ For example, BPF_IND | BPF_W | BPF_LD means::
250+
251+ R0 = ntohl(*(u32 *) (((struct sk_buff *) R6)->data + src_reg + imm32))
252+
253+ and R1 - R5 are clobbered.
0 commit comments