Skip to content

Commit 92561f7

Browse files
committed
Add more details about helper function definitions
Signed-off-by: Dave Thaler <[email protected]>
1 parent b0b2151 commit 92561f7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

isa/kernel.org/instruction-set.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,16 @@ set of function calls exposed by the eBPF runtime. Each helper
304304
function is identified by an integer used in a ``BPF_CALL`` instruction.
305305
The available helper functions may differ for each eBPF program type.
306306

307-
Each helper function is implemented with a commonly shared function
307+
Conceptually, each helper function is implemented with a commonly shared function
308308
signature defined as:
309309

310310
uint64_t function(uint64_t r1, uint64_t r2, uint64_t r3, uint64_t r4, uint64_t r5)
311311

312+
In actuality, each helper function is defined as taking between 0 and 5 arguments,
313+
with the remaining registers being ignored. The definition of a helper function
314+
is responsible for specifying the type (e.g., integer, pointer, etc.) of the value returned,
315+
the number of arguments, and the type of each argument.
316+
312317
Load and store instructions
313318
===========================
314319

@@ -523,7 +528,7 @@ opcode imm description reference
523528
0x24 any dst = (uint32_t)(dst * imm) `Arithmetic instructions`_
524529
0x25 any if dst > imm goto +offset `Jump instructions`_
525530
0x26 any if (uint32_t)dst > imm goto +offset `Jump instructions`_
526-
0x27 any dst *= imm `Arithmetic instructions`_
531+
0x27 any dst \*= imm `Arithmetic instructions`_
527532
0x28 any dst = ntohs(*(uint16_t *)(R6->data + imm)) `Load and store instructions`_
528533
0x2c 0x00 dst = (uint32_t)(dst * src) `Arithmetic instructions`_
529534
0x2d 0x00 if dst > src goto +offset `Jump instructions`_

0 commit comments

Comments
 (0)