inteltool: fixed 64 bit build
authorMathias Krause <mathias.krause@secunet.com>
Mon, 27 Jun 2011 12:35:00 +0000 (14:35 +0200)
committerPatrick Georgi <patrick@georgi-clan.de>
Wed, 14 Sep 2011 05:43:19 +0000 (07:43 +0200)
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>
util/inteltool/cpu.c
util/inteltool/inteltool.c

index 9037d5df66fe1af08fea89315a13597adaae0387..20748bda44b0d3b39bfaf118e5f50783aa5b4aca 100644 (file)
 
 #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
index 93169d398c85bad2db7e8e03c08f8d1c47603fae..6fab11864b8e20261ad0d5401c144a776d3f4ad0 100644 (file)
@@ -95,7 +95,7 @@ void *map_physical(uint64_t phys_addr, size_t len)
                    fd_mem, (off_t) phys_addr);
 
        if (virt_addr == MAP_FAILED) {
-               printf("Error mapping physical memory 0x%08lx[0x%x]\n", phys_addr, len);
+               printf("Error mapping physical memory 0x%08lx[0x%zx]\n", phys_addr, len);
                return NULL;
        }