Re: [patch] SMP fixes 2.2.1, #2

Matti Aarnio (matti.aarnio@sonera.fi)
Mon, 1 Feb 1999 23:06:05 +0200 (EET)


> Manuel J. Galan and Mark-Andre Hopf have noticed bugs in the TSC code in
> the previous patch, these are now fixed in the attached patch.
> -- mingo

Inside there was something interesting. My Large-File-Summit stuff
does need similar too -- although only in printk() support, and only
when the BITS_PER_LONG is under 64 (all ia32 systems, of course).
Should we integrate something alike into the general lib/ directory
in the kernel ?

For most of the gcc generated cases we definitely don't want to use
this -- when we are doing some filesystem internal code, for example.
(We don't want __divdi3, __moddi3 et.al. with those gcc library calls!
Rather we want carefully control where the uses occur.)

/Matti Aarnio

....
> +/*
> + * accurate 64-bit division, expanded to 32-bit divisions. Not terribly
> + * optimized but we need it at boot time only anyway.
> + *
> + * result == a / b
> + * == (a1 + a2*(2^32)) / b
> + * == a1/b + a2*(2^32/b)
> + * == a1/b + a2*((2^32-1)/b) + a2/b + (a2*((2^32-1) % b))/b
> + * ^---- (this multiplication can overflow)
> + */
> +
> +unsigned long long div64 (unsigned long long a, unsigned long long b)
> +{

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/