Skip to content

Commit 1910fae

Browse files
paulburtonborkmann
authored andcommitted
MIPS: eBPF: Remove REG_32BIT_ZERO_EX
REG_32BIT_ZERO_EX and REG_64BIT are always handled in exactly the same way, and reg_val_propagate_range() never actually sets any register to type REG_32BIT_ZERO_EX. Remove the redundant & unused REG_32BIT_ZERO_EX. Signed-off-by: Paul Burton <paul.burton@mips.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 1344315 commit 1910fae

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

arch/mips/net/ebpf_jit.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ enum reg_val_type {
7979
REG_64BIT_32BIT,
8080
/* 32-bit compatible, need truncation for 64-bit ops. */
8181
REG_32BIT,
82-
/* 32-bit zero extended. */
83-
REG_32BIT_ZERO_EX,
8482
/* 32-bit no sign/zero extension needed. */
8583
REG_32BIT_POS
8684
};
@@ -349,7 +347,7 @@ static int build_int_epilogue(struct jit_ctx *ctx, int dest_reg)
349347
if (dest_reg == MIPS_R_RA) {
350348
/* Don't let zero extended value escape. */
351349
td = get_reg_val_type(ctx, prog->len, BPF_REG_0);
352-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX)
350+
if (td == REG_64BIT)
353351
emit_instr(ctx, sll, r0, r0, 0);
354352
}
355353

@@ -695,7 +693,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
695693
if (dst < 0)
696694
return dst;
697695
td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
698-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) {
696+
if (td == REG_64BIT) {
699697
/* sign extend */
700698
emit_instr(ctx, sll, dst, dst, 0);
701699
}
@@ -710,7 +708,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
710708
if (dst < 0)
711709
return dst;
712710
td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
713-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) {
711+
if (td == REG_64BIT) {
714712
/* sign extend */
715713
emit_instr(ctx, sll, dst, dst, 0);
716714
}
@@ -724,7 +722,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
724722
if (dst < 0)
725723
return dst;
726724
td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
727-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX)
725+
if (td == REG_64BIT)
728726
/* sign extend */
729727
emit_instr(ctx, sll, dst, dst, 0);
730728
if (insn->imm == 1) {
@@ -863,13 +861,13 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
863861
if (src < 0 || dst < 0)
864862
return -EINVAL;
865863
td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
866-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) {
864+
if (td == REG_64BIT) {
867865
/* sign extend */
868866
emit_instr(ctx, sll, dst, dst, 0);
869867
}
870868
did_move = false;
871869
ts = get_reg_val_type(ctx, this_idx, insn->src_reg);
872-
if (ts == REG_64BIT || ts == REG_32BIT_ZERO_EX) {
870+
if (ts == REG_64BIT) {
873871
int tmp_reg = MIPS_R_AT;
874872

875873
if (bpf_op == BPF_MOV) {
@@ -1257,8 +1255,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
12571255
if (insn->imm == 64 && td == REG_32BIT)
12581256
emit_instr(ctx, dinsu, dst, MIPS_R_ZERO, 32, 32);
12591257

1260-
if (insn->imm != 64 &&
1261-
(td == REG_64BIT || td == REG_32BIT_ZERO_EX)) {
1258+
if (insn->imm != 64 && td == REG_64BIT) {
12621259
/* sign extend */
12631260
emit_instr(ctx, sll, dst, dst, 0);
12641261
}

0 commit comments

Comments
 (0)