Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jul 2003 20:05:14 +0100
From:      Josef Karthauser <joe@FreeBSD.org>
To:        arch@freebsd.org
Subject:   Importing 'mstohz' from NetBSD.
Message-ID:  <20030714190514.GA3270@genius.tao.org.uk>

next in thread | raw e-mail | index | archive | help

--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

It looks like NetBSD have a net function defined in the kernel.

    --- param.h	2002/03/17 19:43:07	1.137
    +++ param.h	2002/04/05 18:27:57	1.138
    @@ -1,4 +1,4 @@
    -/*	$NetBSD: param.h,v 1.136 2002/03/09 01:42:13 thorpej Exp $	*/
    +/*	$NetBSD: param.h,v 1.137 2002/03/17 19:43:07 atatat Exp $	*/
    =20
     /*-
      * Copyright (c) 1982, 1986, 1989, 1993
    @@ -274,5 +274,20 @@
     #ifndef UBC_NWINS
     #define	UBC_NWINS	1024
     #endif
    +
    +#ifdef _KERNEL
    +/*
    + * macro to convert from milliseconds to hz without integer overflow
    + * Default version using only 32bits arithmetics.
    + * 64bit port can define 64bit version in their <machine/param.h>
    + * 0x20000 is safe for hz < 20000
    + */
    +#ifndef mstohz
    +#define mstohz(ms) \
    +	(__predict_false((ms) >=3D 0x20000) ? \
    +	    ((ms +0u) / 1000u) * hz : \
    +	    ((ms +0u) * hz) / 1000u)
    +#endif
    +#endif /* _KERNEL */
    =20
     #endif /* !_SYS_PARAM_H_ */

They have replaced TICKS_TO_HZ with calls to 'mstohz' in the usb stack
as well as in other places.  Is this something that we want to do also?

Joe
--=20
Josef Karthauser (joe@tao.org.uk)	       http://www.josef-k.net/
FreeBSD (cvs meister, admin and hacker)     http://www.uk.FreeBSD.org/
Physics Particle Theory (student)   http://www.pact.cpes.sussex.ac.uk/
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D An eclectic mix of fact an=
d theory. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

--LZvS9be/3tNcYl/X
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iEYEARECAAYFAj8S/uoACgkQXVIcjOaxUBaKHgCfVLa4RfUMCoCBfN0aKmqWlpZ3
rwwAnRizAO3TlWVsZ/zGmKtwwTNAyTC3
=bUOR
-----END PGP SIGNATURE-----

--LZvS9be/3tNcYl/X--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030714190514.GA3270>