On Tue, 9 Dec 2003, Andy Polyakov wrote:

> appears appropriate under this ABI. But keep in mind that OpenSSL is not
> exclusively about Linux and we have to think of a common denominator

oh don't worry -- those ELF ABI calling conventions are used on all x86
unix (and are essentially the same if you're crazy enough to still use
a.out).  also i've doublechecked the windoze conventions and they're the
same w.r.t. mmx and xmm registers.  all i need is the EMMS prior to
returning.


> To compile with -fPIC you have to
>
>         __asm volatile(
>                 "push %%ebx; cpuid; pop %%ebx"
>                 : "=a" (eax), "=c" (ecx), "=d" (edx)
>                 : "0" (1));
>
> As compiler wants %ebx for itself.

ah ok ... that's pretty lame that gcc doesn't generate save/restore code
automatically.  but easy enough to fix, thanks.


> Well, if you insist on performing even that check and catch SIGILL, why
> bother with cpuid instruction at all? Just issue xorps and see if it
> traps.

i'm being proactive with the cpuid check -- i've got some ideas for perf
improvements which will require only MMX.  i dunno if they'll pan out, but
i figured i'd get the infrastructure all in at once.


> Well, what I *really* try to say with this, or rather with "more
> common denominator than pthread_once," is that we might as well decide
> that cpuid check is sufficient and *demand* that toolkit compiled with
> SSE2 support will be executed under OS which supports it.

yeah... i don't know about other kernels, but for linux it requires 2.4 or
later (well i assume somewhere in 2.3.x they started using FXSAVE/FXRESTOR
to enable SSE).  if you're content to not include this check then i'm
happy not including it :)


> On ELF platforms you can drop code into .init section (see
> http://www.openssl.org/~appro/usatomic/ for samples). More "portable"
> way is to rely on C++ run-time environment and instantiate a static
> class with appropriate constructor. A.

i'd also be happy to use .init and restrict this to working on ELF
systems... plus i know there's something similar for windoze, i'll dig it
up.

-dean

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to