[HVM] Cleanup: move cpuid function to util.c . Signed-off-by: Andrew D. Ball <aball@us.ibm.com> diff -r f328519053f5 -r 4cc861f6b425 tools/firmware/hvmloader/hvmloader.c --- a/tools/firmware/hvmloader/hvmloader.c Mon Aug 14 10:58:02 2006 +0100 +++ b/tools/firmware/hvmloader/hvmloader.c Mon Aug 14 11:16:09 2006 -0400 @@ -116,15 +116,6 @@ check_amd(void) } static void -cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) -{ - __asm__ __volatile__( - "cpuid" - : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) - : "0" (idx) ); -} - -static void wrmsr(uint32_t idx, uint64_t v) { __asm__ __volatile__( diff -r f328519053f5 -r 4cc861f6b425 tools/firmware/hvmloader/util.c --- a/tools/firmware/hvmloader/util.c Mon Aug 14 10:58:02 2006 +0100 +++ b/tools/firmware/hvmloader/util.c Mon Aug 14 11:16:09 2006 -0400 @@ -94,3 +94,12 @@ void puts(const char *s) while (*s) outb(0xE9, *s++); } + +void +cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) +{ + __asm__ __volatile__( + "cpuid" + : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) + : "0" (idx) ); +} diff -r f328519053f5 -r 4cc861f6b425 tools/firmware/hvmloader/util.h --- a/tools/firmware/hvmloader/util.h Mon Aug 14 10:58:02 2006 +0100 +++ b/tools/firmware/hvmloader/util.h Mon Aug 14 11:16:09 2006 -0400 @@ -8,6 +8,10 @@ void outb(uint16_t addr, uint8_t val); /* I/O input */ uint8_t inb(uint16_t addr); +/* Do cpuid instruction, with operation ''idx'' */ +void +cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); + /* String and memory functions */ int strcmp(const char *cs, const char *ct); void *memcpy(void *dest, const void *src, unsigned n); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel