lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 14 Mar 2008 18:45:09 +0100 (CET)
From:	Roman Zippel <zippel@...ux-m68k.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
cc:	Geert.Uytterhoeven@...ycom.com, linux-kernel@...r.kernel.org,
	Avi Kivity <avi@...ranet.com>
Subject: Re: [PATCH 1/4] introduce explicit signed/unsigned 64bit divide

Hi,

On Thu, 13 Mar 2008, Andrew Morton wrote:

> I think what happened was that [patch 3/4] fixed this up.  Of course,
> that patch doesn't apply on this updated [1/4].  I _could_ just take the
> old [1/4] (I think), but I don't know if that wouild be bisection-friendly.
> 
> Anyway, please redo&resend?  Thanks.

Done.

> Please have a think about that code in arch/x86/kvm/i8254.c too.  It is
> painful to see remote subsystems (re)implementing generic infrastructure.
> Can KVM use existing code?  Should we hoist what KVM has done there into
> generic code?  Did it have to use a(nother bleeding) macro?

Looker closer at it, div64_u64() seems to be a bit overkill, as the 
divisor is a 32bit value, so the following should do the same job (only 
compile tested):

u64 muldiv64(u64 a, u32 b, u32 c)
{       
	union { 
		u64 ll;
		struct {
			u32 low, high;
		};
	} u, res, rl, rh;

	u.ll = a;
	rl.ll = (u64)b * u.low;
	rh.ll = (u64)b * u.high;
	rh.ll += rl.high;
	res.high = div_u64_rem(rh.ll, c, &rl.high);
	res.low = div_u64(rl.ll, c);
	return res.ll;
}

Moving it to a more generic location shouldn't be a big problem.

bye, Roman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ