6 &asm_init($ARGV[0],"x86cpuid");
8 &function_begin("OPENSSL_ia32_cpuid");
20 &jnc (&label("nocpuid"));
23 &set_label("nocpuid");
26 &function_end("OPENSSL_ia32_cpuid");
28 &external_label("OPENSSL_ia32cap_P");
30 &function_begin_B("OPENSSL_rdtsc","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
33 &picmeup("ecx","OPENSSL_ia32cap_P");
34 &bt (&DWP(0,"ecx"),4);
35 &jnc (&label("notsc"));
39 &function_end_B("OPENSSL_rdtsc");
41 # This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host],
42 # but it's safe to call it on any [supported] 32-bit platform...
43 # Just check for [non-]zero return value...
44 &function_begin_B("OPENSSL_instrument_halt","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
45 &picmeup("ecx","OPENSSL_ia32cap_P");
46 &bt (&DWP(0,"ecx"),4);
47 &jnc (&label("nohalt")); # no TSC
49 &data_word(0x9058900e); # push %cs; pop %eax
51 &jnz (&label("nohalt")); # not enough privileges
56 &jnc (&label("nohalt")); # interrupts are disabled
64 &sub ("eax",&DWP(0,"esp"));
65 &sbb ("edx",&DWP(4,"esp"));
73 &function_end_B("OPENSSL_instrument_halt");
75 &initseg("OPENSSL_cpuid_setup");