
On 01/29/2012 10:53 PM, John Salmon wrote:
You're correct. I mistakenly assumed that you couldn't use AESNI instructions in 32-bit code. I'm not sure why anyone would want to, but it *is* possible. I'll add the code to push and pop %ebx around cpuid.
The definition of cpuid I personally use is #if !defined(__PIC__) || defined(__x86_64__) __asm__ __volatile__ ( "cpuid" : "=a" (CPUInfo[eax]), "=b" (CPUInfo[ebx]) , "=c" (CPUInfo[ecx]), "=d" (CPUInfo[edx]) : "a" (InfoType) : "cc" ); #else __asm__ __volatile__ ( "pushl %%ebx \n\t" /* save %ebx */ "cpuid \n\t" "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ "popl %%ebx \n\t" /* restore the old %ebx */ : "=a"(CPUInfo[eax]), "=r"(CPUInfo[ebx]) , "=c"(CPUInfo[ecx]), "=d"(CPUInfo[edx]) : "a"(InfoType) : "cc" ); #endif