diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-08-29 17:28:42 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-08-29 17:28:42 +0200 |
commit | 0b7b701d334b0033f9a88cabf575b6e77017861a (patch) | |
tree | cfac953396ae15d30751d650f5090aabf6de5fbc | |
parent | ee1a19267a3a3a7c42f9171e85d94f6ba48d125f (diff) | |
download | gnutls-0b7b701d334b0033f9a88cabf575b6e77017861a.tar.gz |
Modified cpuid for 32-bit x86 to avoid a gcc issue (not finding a register).
-rw-r--r-- | lib/accelerated/x86.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/accelerated/x86.h b/lib/accelerated/x86.h index 8886516f4e..df411dfa39 100644 --- a/lib/accelerated/x86.h +++ b/lib/accelerated/x86.h @@ -5,8 +5,27 @@ # define cpuid __cpuid #else -#define cpuid(func,ax,bx,cx,dx)\ + +# ifdef ASM_X86_64 + +# define cpuid(func,ax,bx,cx,dx)\ __asm__ __volatile__ ("cpuid":\ "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func)); +# else +/* some GCC versions complain on the version above */ +# define cpuid(func, a, b, c, d) g_cpuid(func, &a, &b, &c, &d) + +inline static void g_cpuid(uint32_t func, unsigned int *ax, unsigned int *bx, unsigned int *cx, unsigned int* dx) +{ + asm volatile ("pushl %%ebx\n" + "cpuid\n" + "movl %%ebx, %1\n" + "popl %%ebx\n" + :"=a" (*ax), "=r"(*bx), "=c"(*cx), "=d"(*cx) + :"a"(func) + :"cc"); +} +# endif + #endif |