[PATCH 09/14] cputest: Add cpuidLeaf helper to cpu-cpuid.py

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

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 tests/cputestdata/cpu-cpuid.py | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py
index 9ea858d98..f4cf6d440 100755
--- a/tests/cputestdata/cpu-cpuid.py
+++ b/tests/cputestdata/cpu-cpuid.py
@@ -189,6 +189,18 @@ def cpuidIsSet(cpuid, feature):
                 (edx > 0 and leaf["edx"] & edx > 0))
 
 
+def cpuidLeaf(cpuid, in_eax, in_ecx):
+    if in_eax not in cpuid:
+        cpuid[in_eax] = {}
+    leaf = cpuid[in_eax]
+
+    if in_ecx not in leaf:
+        leaf[in_ecx] = {"eax": 0, "ebx": 0, "ecx": 0, "edx": 0}
+    leaf = leaf[in_ecx]
+
+    return leaf
+
+
 def parseFeatureWords(path):
     features = None
 
@@ -222,14 +234,7 @@ def parseFeatureWords(path):
         if "cpuid-input-ecx" in feat:
             in_ecx = feat["cpuid-input-ecx"]
 
-        if in_eax not in cpuid:
-            cpuid[in_eax] = {}
-        leaf = cpuid[in_eax]
-
-        if in_ecx not in leaf:
-            leaf[in_ecx] = {"eax": 0, "ebx": 0, "ecx": 0, "edx": 0}
-        leaf = leaf[in_ecx]
-
+        leaf = cpuidLeaf(cpuid, in_eax, in_ecx)
         leaf[feat["cpuid-register"].lower()] = feat["features"]
 
     return props, cpuid
-- 
2.12.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux