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

[Xen-devel] Re: [RFC, PATCH 12/24] i386 Vmi processor header



Chuck Ebbert wrote:

+/* Some CPUID calls want 'count' to be placed in ecx */
+static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx,
+             int *edx)
+{
+     asm volatile(""::"c"(count));
+     vmi_cpuid(op, eax, ebx, ecx, edx);
+}

You can't assume those last two statements will stay together.
>From the gcc 4.0.2 info file:

I know. I've abused this a bit. When we originally wrote the cpuid call, there were no ecx dependencies on cpuid. Never got around to fixing it properly.
<...> you can't expect a sequence of volatile `asm' instructions
to remain perfectly consecutive.  If you want consecutive output, use a
single `asm'.

Maybe you could make vmi_cpuid always take a 'count' param, then just make cpuid
do:

        vmi_cpuid(op, 0, eax, ebx, ecx, edx);

and cpuid_count do:

        vmi_cpuid(op, count, eax, ebx, ecx, edx);

That is the proper fix.  I'll put that in the next round.


(And sorry about trimming the cc: but I'm reading from a digest and that list
is too long to enter manually.)

N.P.

Thanks for looking at my code,
Zach

_______________________________________________
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®.