summaryrefslogtreecommitdiff
path: root/util/inteltool/cpu.c
diff options
context:
space:
mode:
authorMathias Krause <mathias.krause@secunet.com>2011-06-27 14:35:00 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2011-09-14 07:43:19 +0200
commit9beb5df3c4c35ddefa35742633a7876852065fae (patch)
treeafdbd89636e593deff93ca876f11389c7c65d664 /util/inteltool/cpu.c
parent5782fee0e14557963149c47ad07cf1d235196f67 (diff)
inteltool: fixed 64 bit build
The inline assembly for cpuid() was 32 bit specific. Additionally a format string referencing a size_t argument wasn't using the %z length modifier. Change-Id: Iac4a4d5ca81f9bf67bb7b8772013bf6c289e4301 Signed-off-by: Mathias Krause <mathias.krause@secunet.com> Reviewed-on: http://review.coreboot.org/211 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones <marcj303@gmail.com>
Diffstat (limited to 'util/inteltool/cpu.c')
-rw-r--r--util/inteltool/cpu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/util/inteltool/cpu.c b/util/inteltool/cpu.c
index 9037d5df66..20748bda44 100644
--- a/util/inteltool/cpu.c
+++ b/util/inteltool/cpu.c
@@ -26,6 +26,12 @@
#include "inteltool.h"
+#ifdef __x86_64__
+# define BREG "%%rbx"
+#else
+# define BREG "%%ebx"
+#endif
+
int fd_msr;
unsigned int cpuid(unsigned int op)
@@ -34,9 +40,9 @@ unsigned int cpuid(unsigned int op)
#if defined(__PIC__) || defined(__DARWIN__) && !defined(__LP64__)
asm volatile (
- "pushl %%ebx\n"
- "cpuid\n"
- "popl %%ebx\n"
+ "push " BREG "\n\t"
+ "cpuid\n\t"
+ "pop " BREG "\n\t"
: "=a" (ret) : "a" (op) : "%ecx", "%edx"
);
#else