HEADS DOWN

Bruce Evans bde at zeta.org.au
Sun May 6 10:16:18 UTC 2007


On Sun, 6 May 2007, Kostik Belousov wrote:

> On Sun, May 06, 2007 at 10:59:23AM +1000, Bruce Evans wrote:
>> The setup overhead for using string instructions may be much larger than
>> the 14-16 in the above table.  It is also necessary to set the direction
>> flag and maybe to shuffle registers so as to use the registers required
>> by the string instructions.  cld/std is fast enough on Athlons (1/2
>> cycles) but is slow on Pentium4 and later (IIRC, 43 cycles for std on
>> one Pentium model).
> gcc 4.3 claims to not issue cld instruction anymore (ABI requires direction
> flag to be clear since eon).

Ha, the library for my compiler required this in 1988 (its ABI is
supposed to be compatible with other compilers, and seemed to be
compatible with several including gcc and 2 unusual ones).

However, FreeBSD has never really supported this -- it doesn't touch
the direction flag for signal handling.  String functions don't seem
to be required to be async signal-safe in draft POSIX.1-2001, but they
should be in practice (when called on an string in local storage), and
things like struct copies (to and from local variables) are required
to work even for C90 signal handlers.

Bruce


More information about the freebsd-arch mailing list