Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35a8e16a authored by Markos Chandras's avatar Markos Chandras Committed by Ralf Baechle
Browse files

MIPS: bpf: Use the LO register to get division's quotient



Reading from the HI register to get the division result is wrong.
The quotient is placed in the LO register.

Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Daniel Borkmann <dborkman@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: netdev@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7122/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 84c68cbc
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -408,7 +408,7 @@ static inline void emit_div(unsigned int dst, unsigned int src,
		u32 *p = &ctx->target[ctx->idx];
		u32 *p = &ctx->target[ctx->idx];
		uasm_i_divu(&p, dst, src);
		uasm_i_divu(&p, dst, src);
		p = &ctx->target[ctx->idx + 1];
		p = &ctx->target[ctx->idx + 1];
		uasm_i_mfhi(&p, dst);
		uasm_i_mflo(&p, dst);
	}
	}
	ctx->idx += 2; /* 2 insts */
	ctx->idx += 2; /* 2 insts */
}
}