[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] libxc-x86-64-fixes.patch



Arun Sharma wrote:


+#ifdef __i386__
__asm__ __volatile__ ("pushl %%ebx; cpuid; popl %%ebx" : "=a" (eax), "=c" (ecx) : "0" (1) : "dx");
+#elif defined __x86_64__
+    __asm__ __volatile__ ("pushq %%rbx; cpuid; popq %%rbx"
+                          : "=a" (eax), "=c" (ecx)
+                          : "0" (1)
+                          : "dx");
+#endif
+
Does this mean the ebx-clobbering bug in gcc 3.4 also exists on x86-64 (except it clobbers rbx instead)?

I really hate to see this end up a permanent part of the tree... perhaps we should add a Linux style cpuid() function:

static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
{
   int ax, bx, cx, dx;

#if defined __i386__ || defined __x86_64__
   __asm__("cpuid"
       : "=a" (ax),
         "=b" (bx),
         "=c" (cx),
         "=d" (dx)
       : "0" (op));
#else
#error cpuid not defined on current architecture
#endif

   if (eax) *eax = ax;
   if (ebx) *ebx = bx;
   if (ecx) *ecx = cx
   if (edx) *edx = dx;
}

This should take care of the ebx clobbering bug while also resulting in more shared code.

Just a thought.

Regards,
Anthony Liguori

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.