Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKzz4-0004Gc-VG for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:51:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKzz4-0004GG-EL for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:51:58 -0500 Received: from [199.232.76.173] (port=56678 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKzz4-0004G6-AO for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:51:58 -0500 Received: from hall.aurel32.net ([88.191.82.174]:32876) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LKzz3-0007Uu-M6 for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:51:57 -0500 Received: from aurel32 by hall.aurel32.net with local (Exim 4.69) (envelope-from ) id 1LKzyz-0001OX-Bs for qemu-devel@nongnu.org; Thu, 08 Jan 2009 19:51:53 +0100 Date: Thu, 8 Jan 2009 19:51:53 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] MIPS CP0 Random register fix Message-ID: <20090108185153.GF22095@hall.aurel32.net> References: <495F9E4D.4060202@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <495F9E4D.4060202@reactos.org> Sender: Aurelien Jarno Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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