Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-release-src > by-pkgid > e674b893bb214c063800f4e5e929c1aa > files > 4

x86info-1.23-2mdv2010.0.src.rpm

2006-03-21  Gwenole Beauchesne  <gbeauchesne@mandriva.com>

	* Intel/cachesize.c (L1I_cache_table): Fix typo.
	(decode_cache): Fix for 64-bit builds.
	(decode_Intel_caches): Report unknown cache descriptors as hex
	values.

--- x86info-1.17/Intel/cachesize.c.intel-caches	2006-03-21 22:29:29.000000000 +0100
+++ x86info-1.17/Intel/cachesize.c	2006-03-21 22:50:04.000000000 +0100
@@ -37,7 +37,7 @@ static struct _cache_table L1I_cache_tab
 {
 	{ 0x6,  8, "L1 Instruction cache:\n\tSize: 8KB\t4-way associative.\n\tline size=32 bytes." },
 	{ 0x8,  16, "L1 Instruction cache:\n\tSize: 16KB\t4-way associative.\n\tline size=32 bytes." },
-	{ 0x30, 32,	"L1 Instruction cache:\n\t:Size 32KB\t8-way associative.\n\tline size=64 bytes." },
+	{ 0x30, 32,	"L1 Instruction cache:\n\tSize: 32KB\t8-way associative.\n\tline size=64 bytes." },
 	{ 0, 0, 0 }
 };
 
@@ -153,8 +153,7 @@ static void decode_Intel_cache (int des,
 static void decode_cache(struct cpudata *cpu, struct _cache_table *table, int output)
 {
 	int i, j, n;
-	long regs[4];
-	unsigned char *dp = (unsigned char *)regs;
+	unsigned long regs[4];
 
 	/* Decode TLB and cache info */
 	cpuid (cpu->number, 2, &regs[0], &regs[1], &regs[2], &regs[3]);
@@ -167,13 +166,15 @@ static void decode_cache(struct cpudata 
 
 		/* If bit 31 is set, this is an unknown format */
 		for (j=0; j<3; j++)
-			if (regs[j] < 0)
+			if (regs[j] & 0x80000000)
 				regs[j] = 0;
 
 		/* Byte 0 is level count, not a descriptor */
-		for (j=1; j<16; j++)
-			if (dp[j]!=0)
-				decode_Intel_cache (dp[j], cpu, output, table);
+		for (j=1; j<16; j++) {
+			unsigned char val = regs[j / 4] >> (8 * (j % 4));
+			if (val)
+				decode_Intel_cache (val, cpu, output, table);
+		}
 	}
 }
 
@@ -201,7 +202,7 @@ void decode_Intel_caches (struct cpudata
 
 	for (i=0; i<256; i++) {
 		if (unknown_array[i]==1)
-			printf ("%d ", i);
+			printf ("%02x ", i);
 	}
 	printf ("\n");
 	decode_cache (cpu, DTLB_cache_table, output);