summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 0af22fa..f1508c8 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -570,6 +570,19 @@ proc0_post(void *dummy __unused)
}
SYSINIT(p0post, SI_SUB_INTRINSIC_POST, SI_ORDER_FIRST, proc0_post, NULL);
+static void
+random_init(void *dummy __unused)
+{
+
+ /*
+ * After CPU has been started we have some randomness on most
+ * platforms via get_cyclecount(). For platforms that don't
+ * we will reseed random(9) in proc0_post() as well.
+ */
+ srandom(get_cyclecount());
+}
+SYSINIT(random, SI_SUB_RANDOM, SI_ORDER_FIRST, random_init, NULL);
+
/*
***************************************************************************
****
OpenPOWER on IntegriCloud