Blame SOURCES/0013-merge-Github-PR-53.patch

33b0a4
From 89759485f86a48526b4f508a10f7478c76a3f71e Mon Sep 17 00:00:00 2001
33b0a4
From: Lyonel Vincent <lyonel@ezix.org>
33b0a4
Date: Fri, 15 May 2020 16:00:08 +0200
33b0a4
Subject: [PATCH 13/17] merge Github PR #53
33b0a4
33b0a4
---
33b0a4
 src/core/cpuinfo.cc | 21 ++++++++++-----------
33b0a4
 1 file changed, 10 insertions(+), 11 deletions(-)
33b0a4
33b0a4
diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
33b0a4
index eceb83aa4e3a..49f3052d8da1 100644
33b0a4
--- a/src/core/cpuinfo.cc
33b0a4
+++ b/src/core/cpuinfo.cc
33b0a4
@@ -446,6 +446,7 @@ string value)
33b0a4
 
33b0a4
   if (cpu)
33b0a4
   {
33b0a4
+    hw::value family, model, stepping;
33b0a4
 
33b0a4
 // x86 CPUs are assumed to be 32 bits per default
33b0a4
     if(cpu->getWidth()==0) cpu->setWidth(32);
33b0a4
@@ -471,6 +472,13 @@ string value)
33b0a4
       cpu->addHint(id, stoll(value, NULL, 0));
33b0a4
     if (id == "stepping")
33b0a4
       cpu->addHint(id, stoll(value, NULL, 0));
33b0a4
+
33b0a4
+    family = cpu->getHint("cpu family");
33b0a4
+    model = cpu->getHint("model");
33b0a4
+    stepping = cpu->getHint("stepping");
33b0a4
+    if(family.defined() && model.defined() && stepping.defined())
33b0a4
+            cpu->setVersion(tostring(family.asInteger())+"."+tostring(model.asInteger())+"."+tostring(stepping.asInteger()));
33b0a4
+
33b0a4
 //if ((id == "cpu MHz") && (cpu->getSize() == 0))
33b0a4
 //{
33b0a4
 //cpu->setSize((long long) (1000000L * atof(value.c_str())));
33b0a4
@@ -675,17 +683,8 @@ bool scan_cpuinfo(hwNode & n)
33b0a4
   }
33b0a4
 
33b0a4
   hwNode *cpu = getcpu(n, 0);
33b0a4
-  if(cpu)
33b0a4
-  {
33b0a4
-    hw::value family, model, stepping;
33b0a4
-    family = cpu->getHint("cpu family");
33b0a4
-    model = cpu->getHint("model");
33b0a4
-    stepping = cpu->getHint("stepping");
33b0a4
-    if(family.defined() && model.defined() && stepping.defined())
33b0a4
-	    cpu->setVersion(tostring(family.asInteger())+"."+tostring(model.asInteger())+"."+tostring(stepping.asInteger()));
33b0a4
-    if(n.getWidth()==0)
33b0a4
-      n.setWidth(cpu->getWidth());
33b0a4
-  }
33b0a4
+  if(cpu && (n.getWidth()==0))
33b0a4
+    n.setWidth(cpu->getWidth());
33b0a4
 
33b0a4
   return true;
33b0a4
 }
33b0a4
-- 
33b0a4
2.17.1
33b0a4