aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDenis Kirjanov <kda@linux-powerpc.org>2014-12-01 04:57:02 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-08 20:22:30 -0500
commit2e46477a12f6fd273e31a220b155d66e8352198c (patch)
treea106c2e098157aa845fdc5d86ff7aae7fed5e7db /arch
parentf2a01517f2a1040a0b156f171a7cefd748f2fd03 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/net/bpf_jit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 9b55143d19db..9fd6834a2172 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -426,7 +426,7 @@ static inline void emit_mod(unsigned int dst, unsigned int src,
426 u32 *p = &ctx->target[ctx->idx]; 426 u32 *p = &ctx->target[ctx->idx];
427 uasm_i_divu(&p, dst, src); 427 uasm_i_divu(&p, dst, src);
428 p = &ctx->target[ctx->idx + 1]; 428 p = &ctx->target[ctx->idx + 1];
429 uasm_i_mflo(&p, dst); 429 uasm_i_mfhi(&p, dst);
430 } 430 }
431 ctx->idx += 2; /* 2 insts */ 431 ctx->idx += 2; /* 2 insts */
432} 432}
@@ -971,7 +971,7 @@ load_ind:
971 break; 971 break;
972 case BPF_ALU | BPF_MOD | BPF_K: 972 case BPF_ALU | BPF_MOD | BPF_K:
973 /* A %= k */ 973 /* A %= k */
974 if (k == 1 || optimize_div(&k)) { 974 if (k == 1) {
975 ctx->flags |= SEEN_A; 975 ctx->flags |= SEEN_A;
976 emit_jit_reg_move(r_A, r_zero, ctx); 976 emit_jit_reg_move(r_A, r_zero, ctx);
977 } else { 977 } else {