summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-10-02 22:58:36 +0200
committerRichard Braun <rbraun@sceen.net>2014-10-02 22:58:36 +0200
commit9035600ebf6d06efcc21576e75766d82ab2b5e69 (patch)
treecd6d0bc31dc30ada55cf44e9f521a5f5faec8fa5
parent68ec6c7517e09ef0869d81847961667fc7024dc0 (diff)
x86/cpu: fix CPUID usage on amd64
The cpu_cpuid wrapper used unsigned long integers to store register content, although the CPUID instruction uses 32-bits integers in all modes. This was leading to a corruption of the cpu structures. Fix by using unsigned int integers instead.
-rw-r--r--arch/x86/machine/cpu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index 325cfd53..0d14cd7b 100644
--- a/arch/x86/machine/cpu.c
+++ b/arch/x86/machine/cpu.c
@@ -394,8 +394,8 @@ cpu_load_idt(void)
}
static inline void
-cpu_cpuid(unsigned long *eax, unsigned long *ebx, unsigned long *ecx,
- unsigned long *edx)
+cpu_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
+ unsigned int *edx)
{
asm volatile("cpuid" : "+a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx));
}
@@ -406,7 +406,7 @@ cpu_cpuid(unsigned long *eax, unsigned long *ebx, unsigned long *ecx,
static void __init
cpu_init(struct cpu *cpu)
{
- unsigned long eax, ebx, ecx, edx, max_basic, max_extended;
+ unsigned int eax, ebx, ecx, edx, max_basic, max_extended;
/*
* Assume at least an i586 processor.