Blob Blame History Raw
From be1b7ab3f5a634de17359376d559d5c312f5623f Mon Sep 17 00:00:00 2001
Message-Id: <be1b7ab3f5a634de17359376d559d5c312f5623f@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 21 Jun 2019 09:25:35 +0200
Subject: [PATCH] cpu_x86: Make x86cpuidAndBits more general
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The function now works on virCPUx86DataItem and it's renamed as
virCPUx86DataItemAndBits.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit da1efddfa6606520fb5f16622bc522b231484b54)

https://bugzilla.redhat.com/show_bug.cgi?id=1697627

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <c265f1fcb4ab52f884dd9481a426978efa60b8c8.1561068591.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/cpu/cpu_x86.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 5fbf0294bb..54da9a985c 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -242,16 +242,16 @@ virCPUx86DataItemClearBits(virCPUx86DataItemPtr item,
 
 
 static void
-x86cpuidAndBits(virCPUx86CPUID *cpuid,
-                const virCPUx86CPUID *mask)
+virCPUx86DataItemAndBits(virCPUx86DataItemPtr item,
+                         const virCPUx86DataItem *mask)
 {
     if (!mask)
         return;
 
-    cpuid->eax &= mask->eax;
-    cpuid->ebx &= mask->ebx;
-    cpuid->ecx &= mask->ecx;
-    cpuid->edx &= mask->edx;
+    item->cpuid.eax &= mask->cpuid.eax;
+    item->cpuid.ebx &= mask->cpuid.ebx;
+    item->cpuid.ecx &= mask->cpuid.ecx;
+    item->cpuid.edx &= mask->cpuid.edx;
 }
 
 
@@ -447,7 +447,7 @@ x86DataIntersect(virCPUx86Data *data1,
     while ((item1 = virCPUx86DataNext(&iter))) {
         item2 = virCPUx86DataGet(data2, item1);
         if (item2)
-            x86cpuidAndBits(&item1->cpuid, &item2->cpuid);
+            virCPUx86DataItemAndBits(item1, item2);
         else
             virCPUx86DataItemClearBits(item1, item1);
     }
-- 
2.22.0