summaryrefslogtreecommitdiffstats
path: root/isys/smp.c
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2004-03-03 18:37:55 +0000
committerJeremy Katz <katzj@redhat.com>2004-03-03 18:37:55 +0000
commit87cd7ca35755a55430957d2d8cafbcccfc4abc57 (patch)
treec52e08f32cd0829f7efcf1643089a5c19631293b /isys/smp.c
parenta218cb0786afabd22990867caefa4164fe7a45b6 (diff)
downloadanaconda-87cd7ca35755a55430957d2d8cafbcccfc4abc57.tar.gz
anaconda-87cd7ca35755a55430957d2d8cafbcccfc4abc57.tar.xz
anaconda-87cd7ca35755a55430957d2d8cafbcccfc4abc57.zip
switch to doing cpuid_ebx instead of generic cpuid, do ht check on x86_64
too since intel processors with 64 bit extension technology are also HT
Diffstat (limited to 'isys/smp.c')
-rw-r--r--isys/smp.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/isys/smp.c b/isys/smp.c
index 0e32edd1d..068d72354 100644
--- a/isys/smp.c
+++ b/isys/smp.c
@@ -552,21 +552,38 @@ static int intelDetectSMP(void)
/* ---- end mptable mess ---- */
#endif /* __i386__ || __x86_64__ */
-#ifdef __i386__
-static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
+#if defined(__i386__)
+static inline unsigned int cpuid_ebx(int op)
{
- __asm__("pushl %%ebx; cpuid; movl %%ebx,%1; popl %%ebx"
- : "=a"(*eax), "=r"(*ebx), "=c"(*ecx), "=d"(*edx)
- : "0" (op));
+ unsigned int eax, ebx;
+
+ __asm__("cpuid"
+ : "=a" (eax), "=b" (ebx)
+ : "0" (op)
+ : "cx", "dx");
+ return ebx;
+}
+#elif defined(__x86_64__)
+static inline unsigned int cpuid_ebx(int op)
+{
+ unsigned int eax, ebx;
+
+ __asm__("cpuid"
+ : "=a" (eax), "=b" (ebx)
+ : "0" (op)
+ : "cx", "dx");
+ return ebx;
}
+#endif
+#if defined(__i386__) || defined(__x86_64__)
/* XXX: rewrite using /proc/cpuinfo info if it there. Only fall
back to inline asm if it is not */
int detectHT(void)
{
FILE *f;
int htflag = 0;
- uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
+ uint32_t ebx = 0;
int smp_num_siblings = 0;
f = fopen("/proc/cpuinfo", "r");
@@ -589,7 +606,7 @@ int detectHT(void)
if (!htflag)
return 0;
- cpuid(1, &eax, &ebx, &ecx, &edx);
+ ebx = cpuid_ebx(1);
smp_num_siblings = (ebx & 0xff0000) >> 16;
if (smp_num_siblings == 2)