diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-30 07:31:03 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:03 -0500 |
commit | c758ecf62ad94ddfeb4e7d8a5498bdcb2e3c85db (patch) | |
tree | 6a7b8b629bbe935c78cf3933b0cfe25253c563a9 /include/asm-x86/processor_32.h | |
parent | 4e87173eacfd0d798aeeba14026893797826bc93 (diff) |
x86: unify cpuid functions
cpuid is not very different between i386 and x86_64.
We move away the x86_64 version from msr.h, and
unify them at processor.h, where they belong.
cpuid() paravirt then comes for free.
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/processor_32.h')
-rw-r--r-- | include/asm-x86/processor_32.h | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h index 6846cc346400..0d83da198127 100644 --- a/include/asm-x86/processor_32.h +++ b/include/asm-x86/processor_32.h | |||
@@ -133,18 +133,6 @@ extern void detect_ht(struct cpuinfo_x86 *c); | |||
133 | static inline void detect_ht(struct cpuinfo_x86 *c) {} | 133 | static inline void detect_ht(struct cpuinfo_x86 *c) {} |
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, | ||
137 | unsigned int *ecx, unsigned int *edx) | ||
138 | { | ||
139 | /* ecx is often an input as well as an output. */ | ||
140 | __asm__("cpuid" | ||
141 | : "=a" (*eax), | ||
142 | "=b" (*ebx), | ||
143 | "=c" (*ecx), | ||
144 | "=d" (*edx) | ||
145 | : "0" (*eax), "2" (*ecx)); | ||
146 | } | ||
147 | |||
148 | #define load_cr3(pgdir) write_cr3(__pa(pgdir)) | 136 | #define load_cr3(pgdir) write_cr3(__pa(pgdir)) |
149 | 137 | ||
150 | /* | 138 | /* |
@@ -580,7 +568,6 @@ static inline void native_set_iopl_mask(unsigned mask) | |||
580 | #include <asm/paravirt.h> | 568 | #include <asm/paravirt.h> |
581 | #else | 569 | #else |
582 | #define paravirt_enabled() 0 | 570 | #define paravirt_enabled() 0 |
583 | #define __cpuid native_cpuid | ||
584 | 571 | ||
585 | static inline void load_sp0(struct tss_struct *tss, struct thread_struct *thread) | 572 | static inline void load_sp0(struct tss_struct *tss, struct thread_struct *thread) |
586 | { | 573 | { |
@@ -598,62 +585,6 @@ static inline void load_sp0(struct tss_struct *tss, struct thread_struct *thread | |||
598 | #define set_iopl_mask native_set_iopl_mask | 585 | #define set_iopl_mask native_set_iopl_mask |
599 | #endif /* CONFIG_PARAVIRT */ | 586 | #endif /* CONFIG_PARAVIRT */ |
600 | 587 | ||
601 | /* | ||
602 | * Generic CPUID function | ||
603 | * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx | ||
604 | * resulting in stale register contents being returned. | ||
605 | */ | ||
606 | static inline void cpuid(unsigned int op, | ||
607 | unsigned int *eax, unsigned int *ebx, | ||
608 | unsigned int *ecx, unsigned int *edx) | ||
609 | { | ||
610 | *eax = op; | ||
611 | *ecx = 0; | ||
612 | __cpuid(eax, ebx, ecx, edx); | ||
613 | } | ||
614 | |||
615 | /* Some CPUID calls want 'count' to be placed in ecx */ | ||
616 | static inline void cpuid_count(unsigned int op, int count, | ||
617 | unsigned int *eax, unsigned int *ebx, | ||
618 | unsigned int *ecx, unsigned int *edx) | ||
619 | { | ||
620 | *eax = op; | ||
621 | *ecx = count; | ||
622 | __cpuid(eax, ebx, ecx, edx); | ||
623 | } | ||
624 | |||
625 | /* | ||
626 | * CPUID functions returning a single datum | ||
627 | */ | ||
628 | static inline unsigned int cpuid_eax(unsigned int op) | ||
629 | { | ||
630 | unsigned int eax, ebx, ecx, edx; | ||
631 | |||
632 | cpuid(op, &eax, &ebx, &ecx, &edx); | ||
633 | return eax; | ||
634 | } | ||
635 | static inline unsigned int cpuid_ebx(unsigned int op) | ||
636 | { | ||
637 | unsigned int eax, ebx, ecx, edx; | ||
638 | |||
639 | cpuid(op, &eax, &ebx, &ecx, &edx); | ||
640 | return ebx; | ||
641 | } | ||
642 | static inline unsigned int cpuid_ecx(unsigned int op) | ||
643 | { | ||
644 | unsigned int eax, ebx, ecx, edx; | ||
645 | |||
646 | cpuid(op, &eax, &ebx, &ecx, &edx); | ||
647 | return ecx; | ||
648 | } | ||
649 | static inline unsigned int cpuid_edx(unsigned int op) | ||
650 | { | ||
651 | unsigned int eax, ebx, ecx, edx; | ||
652 | |||
653 | cpuid(op, &eax, &ebx, &ecx, &edx); | ||
654 | return edx; | ||
655 | } | ||
656 | |||
657 | /* generic versions from gas */ | 588 | /* generic versions from gas */ |
658 | #define GENERIC_NOP1 ".byte 0x90\n" | 589 | #define GENERIC_NOP1 ".byte 0x90\n" |
659 | #define GENERIC_NOP2 ".byte 0x89,0xf6\n" | 590 | #define GENERIC_NOP2 ".byte 0x89,0xf6\n" |