fixed random register (Ralf Baechle)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1469 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2005-07-02 15:13:42 +00:00
parent dfae6487c0
commit 899abcf513

View File

@ -78,14 +78,14 @@ void cpu_mips_irqctrl_init (void)
{ {
} }
/* MIPS R4K timer */
uint32_t cpu_mips_get_random (CPUState *env) uint32_t cpu_mips_get_random (CPUState *env)
{ {
uint64_t now = qemu_get_clock(vm_clock); uint32_t now = qemu_get_clock(vm_clock);
return (uint32_t)now & 0x0000000F; return now % (MIPS_TLB_NB - env->CP0_Wired) + env->CP0_Wired;
} }
/* MIPS R4K timer */
uint32_t cpu_mips_get_count (CPUState *env) uint32_t cpu_mips_get_count (CPUState *env)
{ {
return env->CP0_Count + return env->CP0_Count +