mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
mips: bpf: Fix broken BPF_MOD
Remove optimize_div() from BPF_MOD | BPF_K case since we don't know the dividend and fix the emit_mod() by reading the mod operation result from HI register Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org> Reviewed-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f2a01517f2
commit
2e46477a12
1 changed files with 2 additions and 2 deletions
|
@ -426,7 +426,7 @@ static inline void emit_mod(unsigned int dst, unsigned int src,
|
|||
u32 *p = &ctx->target[ctx->idx];
|
||||
uasm_i_divu(&p, dst, src);
|
||||
p = &ctx->target[ctx->idx + 1];
|
||||
uasm_i_mflo(&p, dst);
|
||||
uasm_i_mfhi(&p, dst);
|
||||
}
|
||||
ctx->idx += 2; /* 2 insts */
|
||||
}
|
||||
|
@ -971,7 +971,7 @@ static int build_body(struct jit_ctx *ctx)
|
|||
break;
|
||||
case BPF_ALU | BPF_MOD | BPF_K:
|
||||
/* A %= k */
|
||||
if (k == 1 || optimize_div(&k)) {
|
||||
if (k == 1) {
|
||||
ctx->flags |= SEEN_A;
|
||||
emit_jit_reg_move(r_A, r_zero, ctx);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue