Skip to content

Commit 597b171

Browse files
sm00thmpe
authored andcommitted
powerpc64/bpf: jit support for sign extended mov
Add jit support for sign extended mov. Tested using test_bpf module. Signed-off-by: Artem Savkov <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 717756c commit 597b171

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

arch/powerpc/net/bpf_jit_comp64.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,14 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
676676
/* special mov32 for zext */
677677
EMIT(PPC_RAW_RLWINM(dst_reg, dst_reg, 0, 0, 31));
678678
break;
679-
}
680-
EMIT(PPC_RAW_MR(dst_reg, src_reg));
679+
} else if (off == 8) {
680+
EMIT(PPC_RAW_EXTSB(dst_reg, src_reg));
681+
} else if (off == 16) {
682+
EMIT(PPC_RAW_EXTSH(dst_reg, src_reg));
683+
} else if (off == 32) {
684+
EMIT(PPC_RAW_EXTSW(dst_reg, src_reg));
685+
} else if (dst_reg != src_reg)
686+
EMIT(PPC_RAW_MR(dst_reg, src_reg));
681687
goto bpf_alu32_trunc;
682688
case BPF_ALU | BPF_MOV | BPF_K: /* (u32) dst = imm */
683689
case BPF_ALU64 | BPF_MOV | BPF_K: /* dst = (s64) imm */

0 commit comments

Comments
 (0)