summaryrefslogtreecommitdiff
path: root/cpuid.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2009-12-10 21:27:44 -0500
committerDave Jones <davej@redhat.com>2009-12-10 21:27:44 -0500
commit375d469eeb15fbcfd831f7b66a0715f42a91a451 (patch)
treed4cfee51c5ab11bd908d30b0de38c9afdef16723 /cpuid.c
parenta8af3758826f545b289a40ecefa627de1e5e9e90 (diff)
Intel CPU topology reworking.
This steals lots of code from the kernel, and munges it to work with userspace. In doing so, I renamed a bunch of x86info's struct cpudata members to match the kernels struct cpu_data, just to make it easier to sync any future changes.
Diffstat (limited to 'cpuid.c')
-rw-r--r--cpuid.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/cpuid.c b/cpuid.c
index a17699c..dccf7ee 100644
--- a/cpuid.c
+++ b/cpuid.c
@@ -195,3 +195,21 @@ void cpuid4(unsigned int CPU_number, unsigned long long idx,
{
cpuid(CPU_number, 4 | (idx << 32), eax, ebx, ecx, edx);
}
+
+/* Some CPUID calls want 'count' to be placed in ecx */
+void cpuid_count(struct cpudata *cpu, unsigned int op, int count,
+ unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx)
+{
+ *ecx = count;
+ cpuid(cpu->number, op, eax, ebx, ecx, edx);
+}
+
+unsigned int cpuid_ebx(struct cpudata *cpu, unsigned int op)
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ cpuid(cpu->number, op, &eax, &ebx, &ecx, &edx);
+
+ return ebx;
+}