Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752770AbYFARgQ (ORCPT ); Sun, 1 Jun 2008 13:36:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751165AbYFARgD (ORCPT ); Sun, 1 Jun 2008 13:36:03 -0400 Received: from jabberwock.ucw.cz ([89.250.246.4]:36476 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbYFARgC (ORCPT ); Sun, 1 Jun 2008 13:36:02 -0400 X-Greylist: delayed 1823 seconds by postgrey-1.27 at vger.kernel.org; Sun, 01 Jun 2008 13:36:02 EDT Date: Sun, 1 Jun 2008 19:05:05 +0200 From: Martin Mares To: Jiri Hladky Cc: linux-kernel@vger.kernel.org Subject: Re: Bug in arch/i386/lib/delay.c file, delay_loop function Message-ID: References: <900048340805300815u57af94b0i3971b22a9d154d1f@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <900048340805300815u57af94b0i3971b22a9d154d1f@mail.gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1133 Lines: 28 Hi! > when trying to understand how Bogomips are implemented I have found > bug in arch/i386/lib/delay.c file, delay_loop function [...] > The function fails for loops > 2^31+1. It because SF is set when dec > returns numbers > 2^31 > > The fix is to use jnz instruction instead of jns (and add one decl > instruction to the end to have exactly the same number of loops as in > original version): It is a long time since I have hacked that file, but you should definitely make sure that the function is never called with a zero argument. In such case, the original version made just a single pass, but your version makes 2^32 of them. Have a nice fortnight -- Martin `MJ' Mares http://mj.ucw.cz/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth Homo homini lupus, frater fratri lupior, bohemus bohemo lupissimus. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/