aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2004-04-26 05:35:20 +0000
committerBill Nottingham <notting@redhat.com>2004-04-26 05:35:20 +0000
commit0ffa5be8c114aa3ceabf0ada48abef4d30a5adac (patch)
tree880d4580fa92fb9747f82820b06a00203bfaab58
parent3cbd1e9fd08d2ef7b29a9e1750866dab54fc1412 (diff)
downloadinitscripts-0ffa5be8c114aa3ceabf0ada48abef4d30a5adac.tar
initscripts-0ffa5be8c114aa3ceabf0ada48abef4d30a5adac.tar.gz
initscripts-0ffa5be8c114aa3ceabf0ada48abef4d30a5adac.tar.bz2
initscripts-0ffa5be8c114aa3ceabf0ada48abef4d30a5adac.tar.xz
initscripts-0ffa5be8c114aa3ceabf0ada48abef4d30a5adac.zip
handle EM64T
-rw-r--r--src/redhat-support-check.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/redhat-support-check.c b/src/redhat-support-check.c
index 280cebc1..03b91a6a 100644
--- a/src/redhat-support-check.c
+++ b/src/redhat-support-check.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2003-2004 Red Hat, Inc. All rights reserved.
*
* This software may be freely redistributed under the terms of the GNU
* public license.
@@ -37,7 +37,7 @@ static char *release_name = NULL;
static int test = 0;
-#ifdef __i386__
+#if defined(__i386__)
static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
{
__asm__("pushl %%ebx; cpuid; movl %%ebx,%1; popl %%ebx"
@@ -46,6 +46,15 @@ static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
}
#endif
+#if defined(__x86_64__)
+static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
+{
+ __asm__("cpuid"
+ : "=a"(*eax), "=r"(*ebx), "=c"(*ecx), "=d"(*edx)
+ : "0" (op));
+}
+#endif
+
guint64 get_memory() {
guint64 npages = sysconf(_SC_PHYS_PAGES);
guint64 pgsize = sysconf(_SC_PAGESIZE);
@@ -57,7 +66,7 @@ unsigned int get_num_cpus() {
int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
u_int32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
-#ifdef __i386__
+#if defined(__i386__) || defined(__x86_64__)
cpuid(0, &eax, &ebx, &ecx, &edx);
if (ebx == 0x756e6547) { /* Intel */
cpuid(1, &eax, &ebx, &ecx, &edx);