linux-mips
[Top] [All Lists]

[PATCH 04/17] MIPS: bpf: Use the LO register to get division's quotient

To: <linux-mips@linux-mips.org>
Subject: [PATCH 04/17] MIPS: bpf: Use the LO register to get division's quotient
From: Markos Chandras <markos.chandras@imgtec.com>
Date: Mon, 23 Jun 2014 10:38:47 +0100
Cc: Markos Chandras <markos.chandras@imgtec.com>, "David S. Miller" <davem@davemloft.net>, Daniel Borkmann <dborkman@redhat.com>, "Alexei Starovoitov" <ast@plumgrid.com>, <netdev@vger.kernel.org>
In-reply-to: <1403516340-22997-1-git-send-email-markos.chandras@imgtec.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1403516340-22997-1-git-send-email-markos.chandras@imgtec.com>
Sender: linux-mips-bounce@linux-mips.org
Reading from the HI register to get the division result is wrong.
The quotient is placed in the LO register.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Daniel Borkmann <dborkman@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 arch/mips/net/bpf_jit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index f7c206404989..5cc92c4590cb 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -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 */
 }
-- 
2.0.0


<Prev in Thread] Current Thread [Next in Thread>