diff --git a/src/arch-x86.c b/src/arch-x86.c
index 44e221e..13bb916 100644
--- a/src/arch-x86.c
+++ b/src/arch-x86.c
@@ -91,12 +91,14 @@ rs_bind_optimized_functions()
  * Function definitions
  *****************************************************************************/
 
-#define cpuid(cmd, eax, ebx, ecx, edx) \
+#define cpuid(cmd, eax, edx) \
   do { \
-     eax = ebx = ecx = edx = 0;	\
+     eax = edx = 0;	\
      asm ( \
-       "cpuid" \
-       : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) \
+       "pushl %%ebx\n\t"\
+       "cpuid\n\t" \
+       "popl %%ebx\n\t" \
+       : "=a" (eax), "=d" (edx) \
        : "0" (cmd) \
      ); \
 } while(0)
@@ -105,13 +107,12 @@ static guint
 rs_detect_cpu_features()
 {
 	guint eax;
-	guint ebx;
-	guint ecx;
 	guint edx;
 	guint cpuflags = 0;
 
 	/* Test cpuid presence comparing eflags */
 	asm (
+		"pushl %%"REG_b"\n\t"
 		"pushf\n\t"
 		"pop %%"REG_a"\n\t"
 		"mov %%"REG_a", %%"REG_b"\n\t"
@@ -124,9 +125,10 @@ rs_detect_cpu_features()
 		"je notfound\n\t"
 		"mov $1, %0\n\t"
 		"notfound:\n\t"
+		"popl %%"REG_b"\n\t"
 		: "=r" (eax)
 		:
-		: REG_a, REG_b
+		: REG_a
 
 		);
 
@@ -136,12 +138,12 @@ rs_detect_cpu_features()
 		guint ext_dsc;
 
 		/* Get the standard level */
-		cpuid(0x00000000, std_dsc, ebx, ecx, edx);
+		cpuid(0x00000000, std_dsc, edx);
 
 		if (std_dsc)
 		{
 			/* Request for standard features */
-			cpuid(0x00000001, std_dsc, ebx, ecx, edx);
+			cpuid(0x00000001, std_dsc, edx);
 
 			if (edx & 0x00800000)
 				cpuflags |= _MMX;
@@ -152,12 +154,12 @@ rs_detect_cpu_features()
 		}
 
 		/* Is there extensions */
-		cpuid(0x80000000, ext_dsc, ebx, ecx, edx);
+		cpuid(0x80000000, ext_dsc, edx);
 
 		if (ext_dsc)
 		{
 			/* Request for extensions */
-			cpuid(0x80000001, eax, ebx, ecx, edx);
+			cpuid(0x80000001, eax, edx);
 
 			if (edx & 0x80000000)
 				cpuflags |= _3DNOW;
