summary refs log tree commit diff stats
path: root/hw/mips_r4k.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/mips_r4k.c')
-rw-r--r--hw/mips_r4k.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 6b6b6cb33b..0cb11683ae 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -27,11 +27,14 @@ void cpu_mips_irqctrl_init (void)
 {
 }
 
+/* XXX: do not use a global */
 uint32_t cpu_mips_get_random (CPUState *env)
 {
-    uint32_t now = qemu_get_clock(vm_clock);
-
-    return now % (MIPS_TLB_NB - env->CP0_Wired) + env->CP0_Wired;
+    static uint32_t seed = 0;
+    uint32_t idx;
+    seed = seed * 314159 + 1;
+    idx = (seed >> 16) % (MIPS_TLB_NB - env->CP0_Wired) + env->CP0_Wired;
+    return idx;
 }
 
 /* MIPS R4K timer */