qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC] MIPS CP0 random register strategy
@ 2009-01-01 19:38 Hervé Poussineau
  2009-01-03 12:29 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Hervé Poussineau @ 2009-01-01 19:38 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

Hello,

MIPS TLBWR instruction asks the CPU to randomly overwrite a TLB entry by 
the one we want to write. The TLB index needs to be between number of 
wired TLB entries and TLB count - 1.
However, algorithm to choose which one to overwrite is implementation 
dependant.

After checking MIPS CPU documentations, 4 algorithms are emerging:
- Random register is decremented once at each clock tick
- Random register is decremented once after 'number of wired TLB 
entries' clock ticks
- Random register is decremented only after TLBWR instruction
- Random register uses a Not Last Used algorithm, ie whatever value 
which is not the previous one

At the moment, Qemu implementation seems to be more the 4th one, but can 
return the same value more than once.
Due to this, NetBSD 1.6.2 on MIPS Magnum emulation crashes.

Attached patch tries to fix the problem by adding 4 methods to update 
Random value.
Each CPU needs to define which Random algorithm it is using.
Patch also optimizes CP0_Random access, by not requiring call to a 
helper function
Finally, it initializes CP0_Random even in user mode emulation, which 
was not the case before.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Please comment

Hervé

[-- Attachment #2: cp0_random.diff --]
[-- Type: plain/text, Size: 11066 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-03 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-01 19:38 [Qemu-devel] [RFC] MIPS CP0 random register strategy Hervé Poussineau
2009-01-03 12:29 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).