Message-ID: From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: I need to advice on timing... Date: Tue, 1 Feb 2000 11:19:31 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id GAA17391 Reply-To: djgpp AT delorie DOT com Dieter Buerssner writes: >>[linux delay loop for almost exact fast timing] >>[...] hence the forced jump instructions at the start > > Could you please explain, why you need these jump instructions. > I donīt get it. The comment at the top of the Linux file arch/i386/lib/delay.c says: /* * Precise Delay Loops for i386 * * Copyright (C) 1993 Linus Torvalds * Copyright (C) 1997 Martin Mares * * The __delay function must _NOT_ be inlined as its execution time * depends wildly on alignment on many x86 processors. The additional * jump magic is needed to get the timing stable on all the CPU's * we have to worry about. */ I don't know the details of exactly why this is, but presumably it is something to do with branch prediction, or forcing which of the two Pentium execution units will be used for the main loop. Shawn Hargreaves.