Uwe Hermann wrote:
-static inline struct cpuid_result cpuid(int op) +static inline struct cpuid_result cpuid(u32 op) {
- struct cpuid_result result;
- asm volatile(
"cpuid"
: "=a" (result.eax),
"=b" (result.ebx),
"=c" (result.ecx),
"=d" (result.edx)
: "0" (op));
- return result;
- struct cpuid_result r;
- _cpuid(op, &r.eax, &r.ebx, %r.ecx, &r.edx);
- return r;
}
+/**
- Generic CPUID function.
- Clear %ecx since some CPUs (Cyrix MII) do not set or clear %ecx,
- resulting in stale register contents being returned.
- */
+static inline void _cpuid(u32 op, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx) +{
- *eax = op;
- *ecx = 0;
- native_cpuid(eax, ebx, ecx, edx);
+}
Is there any reason not to combine these two functions? Maybe it's just me, but I don't like seeing one function call another, make some menial changes then call a third, all with the exact same variables, and to complete one task. And, uh, does this build okay? I don't see a forward declaration of _cpuid, but it might be in the rest of the file or somewhere else.
-Corey