qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] MIPS CP0 Random register fix
@ 2009-01-03 17:20 Hervé Poussineau
  2009-01-08 18:51 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Hervé Poussineau @ 2009-01-03 17:20 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 841 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.

At the moment, Qemu implementation is a random one, but can return the 
same value more than once.
Due to this, NetBSD 1.6.2 on MIPS Magnum emulation crashes.

After checking MIPS CPU documentations, multiple algorithms exist to 
update this Random register, but they all guarantee that 2 close TLBWR 
instructions don't overwrite the same TLB.

Attached patch prevents returning the same TLB index twice, by choosing 
the next immediate value if random value is the same as before.

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

Hervé

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

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

* Re: [Qemu-devel] [PATCH] MIPS CP0 Random register fix
  2009-01-03 17:20 [Qemu-devel] [PATCH] MIPS CP0 Random register fix Hervé Poussineau
@ 2009-01-08 18:51 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2009-01-08 18:51 UTC (permalink / raw)
  To: qemu-devel

On Sat, Jan 03, 2009 at 06:20:13PM +0100, Hervé Poussineau wrote:
> 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.
>
> At the moment, Qemu implementation is a random one, but can return the  
> same value more than once.
> Due to this, NetBSD 1.6.2 on MIPS Magnum emulation crashes.
>
> After checking MIPS CPU documentations, multiple algorithms exist to  
> update this Random register, but they all guarantee that 2 close TLBWR  
> instructions don't overwrite the same TLB.
>
> Attached patch prevents returning the same TLB index twice, by choosing  
> the next immediate value if random value is the same as before.

I have actually applied a different patch, which also change to a better
random generator. PLease confirm that it works.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

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

end of thread, other threads:[~2009-01-08 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-03 17:20 [Qemu-devel] [PATCH] MIPS CP0 Random register fix Hervé Poussineau
2009-01-08 18:51 ` 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).