[coreboot] New patch to review for coreboot: 6c800a2 inteltool: fixed 64 bit build

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Tue Sep 13 10:50:48 CEST 2011


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/211

-gerrit

commit 6c800a257772c52df37e0babf8637ce0de394a42
Author: Mathias Krause <mathias.krause at secunet.com>
Date:   Mon Jun 27 14:35:00 2011 +0200

    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 at secunet.com>
---
 util/inteltool/cpu.c       |   12 +++++++++---
 util/inteltool/inteltool.c |    2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/util/inteltool/cpu.c b/util/inteltool/cpu.c
index 9037d5d..20748bd 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
diff --git a/util/inteltool/inteltool.c b/util/inteltool/inteltool.c
index 93169d3..6fab118 100644
--- a/util/inteltool/inteltool.c
+++ b/util/inteltool/inteltool.c
@@ -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;
 	}
 




More information about the coreboot mailing list