[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] modules/sysinfo: fixed cpu brand string



! brand-string wird nun richtig ausgelesen und angezeigt

Signed-off-by: Stefan Linke <particleflux@xxxxxxxxxxxxxx>
---
 src/modules/sysinfo/cpuid.c   |   32 +++++++++++++++++---------------
 src/modules/sysinfo/sysinfo.c |    2 +-
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/modules/sysinfo/cpuid.c b/src/modules/sysinfo/cpuid.c
index 6f1232e..698ddd1 100644
--- a/src/modules/sysinfo/cpuid.c
+++ b/src/modules/sysinfo/cpuid.c
@@ -192,26 +192,28 @@ cpuid_e1 cpuid_level_e1()
 cpuid_e2_e4 cpuid_level_e2_e4()
 {
     cpuid_e2_e4 result;
+	
     result.eax = 0x80000002;
     cpuid(&result.eax,
-        (uint32_t*)(&result.proc_brand_string[0]),
         (uint32_t*)(&result.proc_brand_string[4]),
-        (uint32_t*)(&result.proc_brand_string[8]));
-    result.eax++;
+        (uint32_t*)(&result.proc_brand_string[8]),
+        (uint32_t*)(&result.proc_brand_string[12]));
+	*((uint32_t *) &result.proc_brand_string[0]) = result.eax;
+    
+	result.eax = 0x80000003;
     cpuid(&result.eax,
-        (uint32_t*)(&result.proc_brand_string[12]),
-        (uint32_t*)(&result.proc_brand_string[16]),
-        (uint32_t*)(&result.proc_brand_string[24]));
-    result.eax++;
-    cpuid(&result.eax,
-        (uint32_t*)(&result.proc_brand_string[28]),
-        (uint32_t*)(&result.proc_brand_string[32]),
-        (uint32_t*)(&result.proc_brand_string[36]));
-    result.eax++;
+        (uint32_t*)(&result.proc_brand_string[20]),
+        (uint32_t*)(&result.proc_brand_string[24]),
+        (uint32_t*)(&result.proc_brand_string[28]));
+	*((uint32_t *) &result.proc_brand_string[16]) = result.eax;
+	
+    result.eax = 0x80000004;
     cpuid(&result.eax,
+        (uint32_t*)(&result.proc_brand_string[36]),
         (uint32_t*)(&result.proc_brand_string[40]),
-        (uint32_t*)(&result.proc_brand_string[44]),
-        (uint32_t*)(&result.proc_brand_string[48]));
-    result.proc_brand_string[49] = '\0';
+        (uint32_t*)(&result.proc_brand_string[44]));
+    *((uint32_t *) &result.proc_brand_string[32]) = result.eax;
+
+    result.proc_brand_string[48] = '\0';
     return result;
 }
diff --git a/src/modules/sysinfo/sysinfo.c b/src/modules/sysinfo/sysinfo.c
index 79eac24..9c6bfec 100644
--- a/src/modules/sysinfo/sysinfo.c
+++ b/src/modules/sysinfo/sysinfo.c
@@ -76,7 +76,7 @@ void sysinfo_create_cpuid_file(void)
     }
 
     // Infoblock schreiben.
-    size = sprintf(content, "%s: %s\n%s: %s\n%s: %i\n%s: 0x%#08X\n%s:",
+    size = sprintf(content, "%s: %s\n%s: %s\n%s: %i\n%s: 0x%08X\n%s:",
             "VendorID",  basic.vendorID,
             "Brand Name", brand.proc_brand_string,
             "Standardlevel", basic.max_level,
-- 
1.7.8.6