From 8fc3647061acb492fe5cb01d7d2820d7489d31e0 Mon Sep 17 00:00:00 2001 Message-Id: <8fc3647061acb492fe5cb01d7d2820d7489d31e0.1715811136.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 20 Jan 2014 16:03:50 +0000 Subject: [PATCH] x86-model: Make it build on amd64. Organization: Straylight/Edgeware From: Mark Wooding It even seems to work. --- configure.ac | 2 +- x86-model.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f0fa614..97e1c30 100644 --- a/configure.ac +++ b/configure.ac @@ -72,7 +72,7 @@ AC_CHECK_FUNC([prlimit], [have_prlimit=yes], [have_prlimit=no]) AM_CONDITIONAL([HAVE_PRLIMIT], [test $have_prlimit = yes]) ## Processor type. -case "$host_cpu" in i?86) x86=yes;; *) x86=no;; esac +case "$host_cpu" in i?86 | x86_64) x86=yes;; *) x86=no;; esac AM_CONDITIONAL([X86], [test $x86 = yes -a $GCC = yes]) dnl-------------------------------------------------------------------------- diff --git a/x86-model.c b/x86-model.c index cb90fb3..05c47c6 100644 --- a/x86-model.c +++ b/x86-model.c @@ -32,7 +32,7 @@ #include #include -#if !defined(__GNUC__) || !defined(__i386__) +#if !defined(__GNUC__) || (!defined(__i386__) && !defined(__amd64__)) # error "This isn't going to work." #endif @@ -44,6 +44,7 @@ struct cpuid { unsigned eax, ebx, ecx, edx; }; static inline void cpuid(unsigned leaf, struct cpuid *c) { + __asm__ ("cpuid" : "=a" (c->eax), "=b" (c->ebx), -- [mdw]