Subject: new MI/MD interface for rnd(4)
To: None <tech-kern@netbsd.org, tech-ports@netbsd.org>
From: Bill Sommerfeld <wes@orchard.arlington.ma.us>
List: tech-kern
Date: 06/05/2000 19:55:41
I just committed changes to the i386 port and to the /dev/random
driver (sys/dev/rnd.c) to let it use a higher-resolution cycle counter
in the timestamps it uses for randomness collection.
Here's a slight rephrasing of the commit message:
If __HAVE_CPU_TIMESTAMP is defined (currently in <machine/types.h>,
which is a dumping ground for similar options), <machine/rnd.h> exists
and defines two functions:
1) u_int32_t cpu_timestamp(void);
returns the 32 low order bits of a reasonably high frequency counter.
2) int cpu_havetimestamp(void);
returns non-zero if cpu_timestamp() actually works.
The timestamp counter should run at a frequency greater than 1 MHz
(otherwise, microtime would be sufficient); other than that, the exact
frequency and origin of the counter are unspecified.
Let me know you have any comments/questions on this (extremely
trivial) optional additional interface. I suspect that other ports
should be able to use this interface pretty easily.
- Bill