Hello!

On Mon, Mar 14, 2011 at 11:30:14PM +0000, Jung-uk Kim wrote:

> Author: jkim
> Date: Mon Mar 14 23:30:14 2011
> New Revision: 219653
> URL: http://svn.freebsd.org/changeset/base/219653
> 
> Log:
>   Make get_cyclecount(9) little bit more useful where binuptime(9) is used.

get_cyclecount(9) is for random harvesting, and dropping half of 
it's entropy in binuptime() case may not be a good idea.

It's probably better to fix manpage instead, to clarify it's 
intended usage.

Maxim Dounin

> 
> Modified:
>   head/sys/arm/include/cpu.h
>   head/sys/i386/include/cpu.h
> 
> Modified: head/sys/arm/include/cpu.h
> ==============================================================================
> --- head/sys/arm/include/cpu.h        Mon Mar 14 23:19:04 2011        
> (r219652)
> +++ head/sys/arm/include/cpu.h        Mon Mar 14 23:30:14 2011        
> (r219653)
> @@ -16,7 +16,7 @@ get_cyclecount(void)
>       struct bintime bt;
>  
>       binuptime(&bt);
> -     return (bt.frac ^ bt.sec);
> +     return ((uint64_t)bt.sec << 56 | bt.frac >> 8);
>                       
>  }
>  #endif
> 
> Modified: head/sys/i386/include/cpu.h
> ==============================================================================
> --- head/sys/i386/include/cpu.h       Mon Mar 14 23:19:04 2011        
> (r219652)
> +++ head/sys/i386/include/cpu.h       Mon Mar 14 23:30:14 2011        
> (r219653)
> @@ -67,7 +67,7 @@ void        swi_vm(void *);
>   * Return contents of in-cpu fast counter as a sort of "bogo-time"
>   * for random-harvesting purposes.
>   */
> -static __inline u_int64_t
> +static __inline uint64_t
>  get_cyclecount(void)
>  {
>  #if defined(I486_CPU) || defined(KLD_MODULE)
> @@ -75,7 +75,7 @@ get_cyclecount(void)
>  
>       if (!tsc_present) {
>               binuptime(&bt);
> -             return (bt.frac ^ bt.sec);
> +             return ((uint64_t)bt.sec << 56 | bt.frac >> 8);
>       }
>  #endif
>       return (rdtsc());
> _______________________________________________
> [email protected] mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "[email protected]"
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to