summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2011-03-15 21:45:10 +0000
committerjkim <jkim@FreeBSD.org>2011-03-15 21:45:10 +0000
commit8060d27e7b3f7a6ad07e1d27babfa72f124b7663 (patch)
tree02f6b9d518f436898f42eb7238f04a21bcc7da27
parent2c6f3a8cd1e07be6b43068ef410a204e2b267143 (diff)
downloadFreeBSD-src-8060d27e7b3f7a6ad07e1d27babfa72f124b7663.zip
FreeBSD-src-8060d27e7b3f7a6ad07e1d27babfa72f124b7663.tar.gz
Partially revert r219672. After r198295, kernel need to seed randomness as
soon as possible for stack protector. However, dummy timecounter does not have enough entropy and we don't need to sacrifice Pentium class and later. Pointed out by: Maxim Dounin (mdounin at mdounin dot ru)
-rw-r--r--sys/i386/include/cpu.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h
index 684c254..42424c8 100644
--- a/sys/i386/include/cpu.h
+++ b/sys/i386/include/cpu.h
@@ -69,10 +69,14 @@ void swi_vm(void *);
static __inline uint64_t
get_cyclecount(void)
{
+#if defined(I486_CPU) || defined(KLD_MODULE)
struct bintime bt;
binuptime(&bt);
return ((uint64_t)bt.sec << 56 | bt.frac >> 8);
+#else
+ return (rdtsc());
+#endif
}
#endif
OpenPOWER on IntegriCloud