Commit 597b1710 authored by Artem Savkov's avatar Artem Savkov Committed by Michael Ellerman
Browse files

powerpc64/bpf: jit support for sign extended mov



Add jit support for sign extended mov. Tested using test_bpf module.

Signed-off-by: default avatarArtem Savkov <asavkov@redhat.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240517075650.248801-5-asavkov@redhat.com
parent 717756c9
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -676,7 +676,13 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
				/* special mov32 for zext */
				EMIT(PPC_RAW_RLWINM(dst_reg, dst_reg, 0, 0, 31));
				break;
			}
			} else if (off == 8) {
				EMIT(PPC_RAW_EXTSB(dst_reg, src_reg));
			} else if (off == 16) {
				EMIT(PPC_RAW_EXTSH(dst_reg, src_reg));
			} else if (off == 32) {
				EMIT(PPC_RAW_EXTSW(dst_reg, src_reg));
			} else if (dst_reg != src_reg)
				EMIT(PPC_RAW_MR(dst_reg, src_reg));
			goto bpf_alu32_trunc;
		case BPF_ALU | BPF_MOV | BPF_K: /* (u32) dst = imm */