[PATCH] hwf-x86: use edi for passing value to ebx for i386 cpuid

Jussi Kivilinna jussi.kivilinna at iki.fi
Fri May 8 17:12:13 CEST 2015


* src/hwf-x86.c [__i386__] (get_cpuid): Use '=D' for regs[1] instead
of '=r'.
--

On Win32, %ebx can be assigned for '=r' (regs[1]). This results invalid
assembly:
	pushl %ebx
	movl %ebx, %ebx
	cpuid
	movl %ebx, %ebx
	popl %ebx

So use '=D' (%esi) for regs[1] instead.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 src/hwf-x86.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hwf-x86.c b/src/hwf-x86.c
index baef2df..399952c 100644
--- a/src/hwf-x86.c
+++ b/src/hwf-x86.c
@@ -81,7 +81,7 @@ get_cpuid(unsigned int in, unsigned int *eax, unsigned int *ebx,
      "cpuid\n\t"
      "movl %%ebx, %1\n\t"
      "popl %%ebx\n\t"            /* Restore GOT register. */
-     : "=a" (regs[0]), "=r" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
+     : "=a" (regs[0]), "=D" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
      : "0" (in), "1" (0), "2" (0), "3" (0)
      : "cc"
      );




More information about the Gcrypt-devel mailing list