From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] libxc-x86-64-fixes.patch Date: Tue, 29 Mar 2005 21:40:30 -0600 Message-ID: <424A1FAE.6000106@us.ibm.com> References: <20050329233303.GA409@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20050329233303.GA409@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Arun Sharma Cc: Ian Pratt , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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