Received: from eggs.gnu.org ([2001:4830:134:3::10]:36306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZB8gp-0003jj-FQ for qemu-devel@nongnu.org; Fri, 03 Jul 2015 17:40:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZB8gk-0006jz-6E for qemu-devel@nongnu.org; Fri, 03 Jul 2015 17:40:07 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:49631 helo=cvs.linux-mips.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZB8gj-0006LT-U8 for qemu-devel@nongnu.org; Fri, 03 Jul 2015 17:40:02 -0400 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S27010544AbbGCVjycgkvL (ORCPT ); Fri, 3 Jul 2015 23:39:54 +0200 Date: Fri, 3 Jul 2015 22:39:54 +0100 (BST) Sender: "Maciej W. Rozycki" From: "Maciej W. Rozycki" In-Reply-To: <20150701101107.GB11361@aurel32.net> Message-ID: References: <478545ddab5b50a804bed4eea1c8f38e155335fa.1435723168.git.serge.vakulenko@gmail.com> <20150701101107.GB11361@aurel32.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH pic32 v2 2/5] Fixed random index generation for TLBWR instruction. It was not quite random and did not skip Wired entries. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: Leon Alrae , Serge Vakulenko , qemu-devel@nongnu.org On Wed, 1 Jul 2015, Aurelien Jarno wrote: > Secondly, I don't think calling random() is the correct thing to do. > It's an expensive function that is not thread safe. Quoting the > specification: > > "Within the required constraints of the upper and lower bounds, the > manner in which the processor selects values for the Random register > is implementation-dependent." > > So it's fine if we use a PRNG like the current code, but I agree we > might want to improve it if it has some issues. We want to keep its > value reproducible though so that the icount mode works as expected. Implementations often implement CP0.Random as a free-running counter that decrements between the bounds set as each instruction executes. Maciej