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>
This commit is contained in:
Mathias Krause 2011-06-27 14:35:00 +02:00 committed by Patrick Georgi
parent 5782fee0e1
commit 9beb5df3c4
2 changed files with 10 additions and 4 deletions

View File

@ -26,6 +26,12 @@
#include "inteltool.h" #include "inteltool.h"
#ifdef __x86_64__
# define BREG "%%rbx"
#else
# define BREG "%%ebx"
#endif
int fd_msr; int fd_msr;
unsigned int cpuid(unsigned int op) unsigned int cpuid(unsigned int op)
@ -34,9 +40,9 @@ unsigned int cpuid(unsigned int op)
#if defined(__PIC__) || defined(__DARWIN__) && !defined(__LP64__) #if defined(__PIC__) || defined(__DARWIN__) && !defined(__LP64__)
asm volatile ( asm volatile (
"pushl %%ebx\n" "push " BREG "\n\t"
"cpuid\n" "cpuid\n\t"
"popl %%ebx\n" "pop " BREG "\n\t"
: "=a" (ret) : "a" (op) : "%ecx", "%edx" : "=a" (ret) : "a" (op) : "%ecx", "%edx"
); );
#else #else

View File

@ -95,7 +95,7 @@ void *map_physical(uint64_t phys_addr, size_t len)
fd_mem, (off_t) phys_addr); fd_mem, (off_t) phys_addr);
if (virt_addr == MAP_FAILED) { 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; return NULL;
} }