Inline asm fix for padlock support

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Mon Jan 21 18:02:20 CET 2008


At Mon, 21 Jan 2008 01:04:00 +0200,
Ismail Dönmez <ismail at pardus.org.tr> wrote:
> Jakub Jelinek of gcc and glibc fame fixed inline asm in padlock support code. 
> His patch and explanation is available at 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34725#c4 .
> 
> I tested the patch and it works.

Yes, but it leaves a superfluous %0 which is not used.  So, I put in a
slightly simpler fix:

  asm volatile
    ("pushl %%ebx\n\t"           /* Save GOT register.  */
     "xorl  %%eax, %%eax\n\t"    /* 0 -> EAX.  */
     "cpuid\n\t"                 /* Get vendor ID.  */
     "movl  %%ebx, (%0)\n\t"     /* EBX,EDX,ECX -> VENDOR_ID.  */
     "movl  %%edx, 4(%0)\n\t"
     "movl  %%ecx, 8(%0)\n\t"
     "popl  %%ebx\n"
     :
     : "S" (&vendor_id[0])
     : "%eax", "%ecx", "%edx", "cc"
     );

Thanks,
Marcus




More information about the Gcrypt-devel mailing list