From: Guillaume Rousse <Guillaume.Rousse@inria.fr>
To: Keir Fraser <keir.fraser@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: porting xen-detect ASM code into a shared library
Date: Thu, 10 Jul 2008 13:42:18 +0200 [thread overview]
Message-ID: <4875F59A.3060107@inria.fr> (raw)
In-Reply-To: <C49BA9C5.23DBD%keir.fraser@eu.citrix.com>
Keir Fraser a écrit :
> On 10/7/08 11:54, "Guillaume Rousse" <Guillaume.Rousse@inria.fr> wrote:
>
>> I turned it into the current way because I don't need the check in pv
>> context, but I guess it might be simplified.
>
> Actually then you can take the xc_cpuid_x86 function pretty much unmodified
> (of course regs[0-3] become eax-edx, and input[1] is not needed).
>
> The other stuff in the asm code is to ensure that cpuid traps into the
> hypervisor when run in a pv guest. If you don't need to run in a pv guest
> then you don't need that extra code.
OK, I tried this:
void Xen_cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t
*ecx, uint32_t *edx)
{
asm (
/* %ebx register need to be saved before usage and restored
thereafter
* for PIC-compliant code on i386 */
#ifdef __i386__
"push %%ebx; cpuid; mov %%ebx,%1; pop %%ebx"
#else
"push %%rbx; cpuid; mov %%ebx,%1; pop %%rbx"
#endif
: "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
: "" (idx), "2" (0) );
But it doesn't build:
misc.c: In function 'Xen_cpuid':
misc.c:1377: warning: asm operand 4 probably doesn't match constraints
misc.c:1377: error: impossible constraint in 'asm'
According to what I understood from GCC-Inline-Assembly-HOWTO, the 4th
operand is probably "=d" (*edx), but I don't see the exact issue.
--
Guillaume Rousse
Moyens Informatiques - INRIA Futurs
Tel: 01 69 35 69 62
next prev parent reply other threads:[~2008-07-10 11:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-10 9:21 porting xen-detect ASM code into a shared library Guillaume Rousse
2008-07-10 9:28 ` Keir Fraser
2008-07-10 10:54 ` Guillaume Rousse
2008-07-10 10:57 ` Keir Fraser
2008-07-10 11:42 ` Guillaume Rousse [this message]
2008-07-10 12:18 ` Keir Fraser
2008-07-10 12:30 ` Guillaume Rousse
2008-07-10 12:31 ` Keir Fraser
2008-07-10 12:43 ` Guillaume Rousse
2008-07-10 12:44 ` Keir Fraser
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=4875F59A.3060107@inria.fr \
--to=guillaume.rousse@inria.fr \
--cc=keir.fraser@eu.citrix.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.