www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/01/18:41:41

Message-ID: <F77915E7F086D31197F4009027CC81C921AA68@probe-2.as-london.acclaim.com>
From: Shawn Hargreaves <SHargreaves AT acclaimstudios DOT co DOT uk>
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)
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 <mj AT atrey DOT karlin DOT mff DOT cuni DOT cz>
 *
 *      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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright Đ 2019   by DJ Delorie     Updated Jul 2019