Re: [PATCH] m68k, bpf: Add initial BPF JIT compiler support
From: bot+bpf-ci
Date: Wed Nov 18 2026 - 11:02:30 EST
> m68k, bpf: Add initial BPF JIT compiler support
TL;DR: Nit only: the "bne.s .+8" style comments in the m68k JIT's 64-bit
compare code are off by 2 (should be .+10); the emitted encoding looks
correct.
> diff --git a/arch/m68k/net/bpf_jit_comp.c b/arch/m68k/net/bpf_jit_comp.c
> new file mode 100644
> --- /dev/null
> +++ b/arch/m68k/net/bpf_jit_comp.c
[ ... ]
> + } else {
> + emit_16(ctx, 0xb080 | (d_hi << 9) | s_hi); /* cmp.l s_hi, d_hi */
> +
> + switch (op) {
> + case BPF_JEQ:
> + emit_16(ctx, 0x6608); /* bne.s .+8 */
> + emit_16(ctx, 0xb080 | (d_lo << 9) | s_lo); /* cmp.l s_lo, d_lo */
> + EMIT_JMP32(0x6700); /* beq.l */
> + break;
[ ... ]
> + case BPF_JGT:
> + EMIT_JMP32(0x6200); /* bhi.l */
> + emit_16(ctx, 0x6508); /* bcs.s .+8 */
This isn't a bug, but are the "bne.s .+8" style comments accurate?
In m68k assembler syntax "." is the address of the current instruction, so
"bne.s .+8" would assemble to 0x6606, since the 8-bit displacement is
relative to the opcode address + 2.
The emitted word 0x6608 has a displacement of 8, so the branch target is
".+10". It skips the 2-byte cmp.l and the 6-byte b<cc>.l, so the code
looks correct and only the comment is off by 2.
The same comment pattern appears for bne.s, bcs.s, bhi.s, blt.s and bgt.s in
the other 64-bit compare cases of emit_jmp(). Would ".+10", or something
like "bne.s +8: skip cmp.l + b<cc>.l", match the encoding better?
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/44337242298