MIPS: bpf: Use the LO register to get division's quotient
authorMarkos Chandras <[email protected]>
Mon, 23 Jun 2014 09:38:47 +0000 (10:38 +0100)
committerRalf Baechle <[email protected]>
Thu, 26 Jun 2014 09:48:20 +0000 (10:48 +0100)
Reading from the HI register to get the division result is wrong.
The quotient is placed in the LO register.

Signed-off-by: Markos Chandras <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/7122/
Signed-off-by: Ralf Baechle <[email protected]>
arch/mips/net/bpf_jit.c

index f7c2064049897099c6205c5d9867ef625c5d2742..5cc92c4590cb7d03da6971f05163706a072bea17 100644 (file)
@@ -408,7 +408,7 @@ static inline void emit_div(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_mfhi(&p, dst);
+               uasm_i_mflo(&p, dst);
        }
        ctx->idx += 2; /* 2 insts */
 }