bpf: add the gotox indirect jump instruction
Reviewer confirms 'ja' is a suitable mnemonic for the BPF gotox instruction.
This discussion revolves around the naming of a new BPF instruction, gotox, which provides an indirect jump. The reviewer, Jose E. Marchesi, initially questioned why ja was chosen over jal. The proposer clarifies that ja is appropriate because the instruction handles both short (16-bit) and long (32-bit) PC-relative displacements, unlike jal which specifically implies a long jump. The reviewer accepts this explanation.
- reviewer
Initially questioned the choice of 'ja' for the BPF gotox instruction but accepted the explanation regarding its PC-relative displacement handling.
“Any reason for not using the existing name `jal' with a register operand rather than introducing `ja'?”
- proposer
Explains that 'ja' is suitable because the instruction supports both short and long displacements, unlike 'jal'.
“currently JA and JAL do PC-relative 16 and 32-bit displacements respectively, so a 64-bit abs addr can map to either.”
Technical Tradeoffs
- Ensures clear and accurate naming conventions for assembly instructions.
- Addresses potential confusion with existing mnemonics.
In Details
This is a review comment on the gotox instruction patch within the BPF instruction series. The discussion focuses on the assembler mnemonic ja versus jal. The key point is that the BPF ja instruction supports both short (16-bit) and long (32-bit) PC-relative displacements, making it a suitable choice for an indirect jump that needs to cover a wide range, whereas jal historically implies a 'long' jump. This clarification resolves the reviewer's concern.
- BPF
- Berkeley Packet Filter, a technology that allows programs to be run in the Linux kernel without altering kernel source code. It's often used for network packet filtering and more general in-kernel computation.
- gotox
- A BPF instruction for indirect jumps, used for jump tables, similar to
gotoin C. - indirect jump
- A jump instruction where the target address is determined at runtime, typically by the value in a register or memory location.
- assembler mnemonic
- A symbolic name given to an assembly language instruction, such as 'mov', 'add', or 'jmp'.
- PC-relative displacement
- An offset added to the program counter (PC) to determine the target address of a jump or branch instruction.