Replace emms with finit in x86cpuid.
[openssl.git] / crypto / x86cpuid.pl
index 9ad9435ffdc031b3330a71781491d58f3ad09f59..4a58651f0f9d4326971d7ffaf468786b2647c36a 100644 (file)
@@ -5,6 +5,8 @@ require "x86asm.pl";
 
 &asm_init($ARGV[0],"x86cpuid");
 
+for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
+
 &function_begin("OPENSSL_ia32_cpuid");
        &xor    ("edx","edx");
        &pushf  ();
@@ -115,20 +117,21 @@ require "x86asm.pl";
        &mov    ("ecx",&DWP(0,"ecx"));
        &bt     (&DWP(0,"ecx"),1);
        &jnc    (&label("no_x87"));
-       &bt     (&DWP(0,"ecx"),26);
-       &jnc    (&label("no_sse2"));
-       &pxor   ("xmm0","xmm0");
-       &pxor   ("xmm1","xmm1");
-       &pxor   ("xmm2","xmm2");
-       &pxor   ("xmm3","xmm3");
-       &pxor   ("xmm4","xmm4");
-       &pxor   ("xmm5","xmm5");
-       &pxor   ("xmm6","xmm6");
-       &pxor   ("xmm7","xmm7");
-&set_label("no_sse2");
-       # just a bunch of fldz to zap the fp/mm bank...
-       &data_word(0xeed9eed9,0xeed9eed9,0xeed9eed9,0xeed9eed9);
-       &emms   ();
+       if ($sse2) {
+               &bt     (&DWP(0,"ecx"),26);
+               &jnc    (&label("no_sse2"));
+               &pxor   ("xmm0","xmm0");
+               &pxor   ("xmm1","xmm1");
+               &pxor   ("xmm2","xmm2");
+               &pxor   ("xmm3","xmm3");
+               &pxor   ("xmm4","xmm4");
+               &pxor   ("xmm5","xmm5");
+               &pxor   ("xmm6","xmm6");
+               &pxor   ("xmm7","xmm7");
+       &set_label("no_sse2");
+       }
+       # just a bunch of fldz to zap the fp/mm bank followed by finit...
+       &data_word(0xeed9eed9,0xeed9eed9,0xeed9eed9,0xeed9eed9,0x90e3db9b);
 &set_label("no_x87");
        &lea    ("eax",&DWP(4,"esp"));
        &ret    ();