All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Arun Sharma <arun.sharma@intel.com>
Cc: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>, xen-devel@lists.xensource.com
Subject: Re: [PATCH] libxc-x86-64-fixes.patch
Date: Tue, 29 Mar 2005 21:40:30 -0600	[thread overview]
Message-ID: <424A1FAE.6000106@us.ibm.com> (raw)
In-Reply-To: <20050329233303.GA409@intel.com>

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

  reply	other threads:[~2005-03-30  3:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-29 23:33 [PATCH] libxc-x86-64-fixes.patch Arun Sharma
2005-03-30  3:40 ` Anthony Liguori [this message]
2005-03-30  6:26   ` Arun Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=424A1FAE.6000106@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=Ian.Pratt@cl.cam.ac.uk \
    --cc=arun.sharma@intel.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.