Mail Archives: djgpp/2000/02/01/18:41:41
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 -