qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] MIPS CP0 Random register fix
Date: Sat, 03 Jan 2009 18:20:13 +0100	[thread overview]
Message-ID: <495F9E4D.4060202@reactos.org> (raw)

[-- 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 --]

             reply	other threads:[~2009-01-03 17:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-03 17:20 Hervé Poussineau [this message]
2009-01-08 18:51 ` [Qemu-devel] [PATCH] MIPS CP0 Random register fix Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=495F9E4D.4060202@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).