Re: [PATCH bpf-next v2] m68k, bpf: Add initial BPF JIT compiler support

[email protected]
Newsgroups org.kernel.vger.linux-m68k,org.kernel.vger.bpf,org.kernel.vger.linux-kernel
Message-ID <035d5a7abbcdf71699e0252146338f553088d642979676250306c47d55aa4003@mail.kernel.org>
> diff --git a/arch/m68k/net/bpf_jit_comp.c b/arch/m68k/net/bpf_jit_comp.c
> new file mode 100644
> index 000000000000..98cef53c6f39
> --- /dev/null
> +++ b/arch/m68k/net/bpf_jit_comp.c

[ ... ]

> +static void emit_alu64_k(const struct bpf_insn *insn, struct jit_ctx *ctx)
> +{

[ ... ]

> +	switch (BPF_OP(insn->code)) {

[ ... ]

> +	case BPF_XOR:
> +		emit_16(ctx, 0xb180 | (s_lo << 9) | d_lo);		/* eor.l d_lo, s_lo */
> +		emit_16(ctx, 0xb180 | (s_hi << 9) | d_hi);		/* eor.l d_hi, s_hi */
> +		break;

This isn't a bug, but the operand order in these comments is reversed.
The m68k encoding 0xb180 | (s_lo << 9) | d_lo represents 'eor.l s_lo,
d_lo', not 'eor.l d_lo, s_lo'. Compare with the identical bytecode in
emit_alu64_x's BPF_XOR case which correctly comments it as 'eor.l s_lo,
d_lo', and emit_alu32_x's BPF_XOR which uses 'eor.l src, dst'.


---
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/25287107687
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.