[syslinux:elflink] elflink: cleanup com32/elflink/modules/cpuid.c

syslinux-bot for Feng Tang feng.tang at intel.com
Thu Aug 12 21:03:35 PDT 2010


Commit-ID:  feb934cbd1c730d3fcd945d7e397c55b3b476bdc
Gitweb:     http://syslinux.zytor.com/commit/feb934cbd1c730d3fcd945d7e397c55b3b476bdc
Author:     Feng Tang <feng.tang at intel.com>
AuthorDate: Wed, 30 Jun 2010 16:02:49 +0800
Committer:  Feng Tang <feng.tang at intel.com>
CommitDate: Tue, 20 Jul 2010 11:10:04 +0800

elflink: cleanup com32/elflink/modules/cpuid.c



---
 com32/elflink/modules/cpuid.c |   52 +++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/com32/elflink/modules/cpuid.c b/com32/elflink/modules/cpuid.c
index eac59d5..1b5d188 100644
--- a/com32/elflink/modules/cpuid.c
+++ b/com32/elflink/modules/cpuid.c
@@ -20,44 +20,42 @@
 
 static void dump_reg(const char *name, uint32_t val)
 {
-    int i;
+	int i;
 
-    printf("%-3s : %10u 0x%08x ", name, val, val);
+	printf("%-3s : %10u 0x%08x ", name, val, val);
 
-    for (i = 3; i >= 0; i--) {
-	uint8_t c = val >> (i*8);
-	putchar((c >= ' ' && c <= '~') ? c : '.');
-    }
-    putchar('\n');
+	for (i = 3; i >= 0; i--) {
+		uint8_t c = val >> (i*8);
+		putchar((c >= ' ' && c <= '~') ? c : '.');
+	}
+	putchar('\n');
 }
 
 static int cpuid_main(int argc, char *argv[])
 {
-    uint32_t leaf, counter;
-    uint32_t eax, ebx, ecx, edx;
+	uint32_t leaf, counter;
+	uint32_t eax, ebx, ecx, edx;
 
-    if (argc < 2 || argc > 4) {
-	printf("Usage: %s leaf [counter]\n", argv[0]);
-	exit(1);
-    }
+	if (argc < 2 || argc > 4) {
+		printf("Usage: %s leaf [counter]\n", argv[0]);
+		exit(1);
+	}
 
-	mp("argv[1] = %s, argv[2] = %s", argv[0], argv[1]);
+	leaf = strtoul(argv[1], NULL, 0);
+	counter = (argc > 2) ? strtoul(argv[2], NULL, 0) : 0;
 
-    leaf = strtoul(argv[1], NULL, 0);
-    counter = (argc > 2) ? strtoul(argv[2], NULL, 0) : 0;
+	if (!cpu_has_eflag(EFLAGS_ID)) {
+		printf("The CPUID instruction is not supported\n");
+		exit(1);
+	}
 
-    if (!cpu_has_eflag(EFLAGS_ID)) {
-	printf("The CPUID instruction is not supported\n");
-	exit(1);
-    }
+	cpuid_count(leaf, counter, &eax, &ebx, &ecx, &edx);
 
-    cpuid_count(leaf, counter, &eax, &ebx, &ecx, &edx);
+	dump_reg("eax", eax);
+	dump_reg("ebx", ebx);
+	dump_reg("ecx", ecx);
+	dump_reg("edx", edx);
 
-    dump_reg("eax", eax);
-    dump_reg("ebx", ebx);
-    dump_reg("ecx", ecx);
-    dump_reg("edx", edx);
-
-    return 0;
+	return 0;
 }
 MODULE_MAIN(cpuid_main);



More information about the Syslinux-commits mailing list