|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] porting xen-detect ASM code into a shared library
Keir Fraser a écrit : On 10/7/08 11:54, "Guillaume Rousse" <Guillaume.Rousse@xxxxxxxx> 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |