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

From: Zachary Amsden
Date: Thu Mar 16 2006 - 13:18:56 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/