From 2eea67a98eab58b46dbf4275819c06c90bc4c5b6 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Fri, 15 Mar 2019 19:50:00 +0100 Subject: [PATCH] cpu_x86: Make x86cpuidMatchMasked more general MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function is renamed as virCPUx86DataItemMatchMasked to reflect the change in parameter types. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- src/cpu/cpu_x86.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 57bdffc3af..b88cd83aed 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -205,13 +205,13 @@ x86cpuidMatch(const virCPUx86CPUID *cpuid1, static bool -x86cpuidMatchMasked(const virCPUx86CPUID *cpuid, - const virCPUx86CPUID *mask) +virCPUx86DataItemMatchMasked(const virCPUx86DataItem *item, + const virCPUx86DataItem *mask) { - return ((cpuid->eax & mask->eax) == mask->eax && - (cpuid->ebx & mask->ebx) == mask->ebx && - (cpuid->ecx & mask->ecx) == mask->ecx && - (cpuid->edx & mask->edx) == mask->edx); + return ((item->cpuid.eax & mask->cpuid.eax) == mask->cpuid.eax && + (item->cpuid.ebx & mask->cpuid.ebx) == mask->cpuid.ebx && + (item->cpuid.ecx & mask->cpuid.ecx) == mask->cpuid.ecx && + (item->cpuid.edx & mask->cpuid.edx) == mask->cpuid.edx); } @@ -475,7 +475,7 @@ x86DataIsSubset(const virCPUx86Data *data, while ((itemSubset = virCPUx86DataNext(&iter))) { if (!(item = virCPUx86DataGet(data, itemSubset)) || - !x86cpuidMatchMasked(&item->cpuid, &itemSubset->cpuid)) + !virCPUx86DataItemMatchMasked(item, itemSubset)) return false; } @@ -516,7 +516,7 @@ x86DataToVendor(const virCPUx86Data *data, for (i = 0; i < map->nvendors; i++) { virCPUx86VendorPtr vendor = map->vendors[i]; if ((item = virCPUx86DataGet(data, &vendor->data)) && - x86cpuidMatchMasked(&item->cpuid, &vendor->data.cpuid)) { + virCPUx86DataItemMatchMasked(item, &vendor->data)) { virCPUx86DataItemClearBits(item, &vendor->data); return vendor; } @@ -1158,7 +1158,7 @@ x86ModelCompare(virCPUx86ModelPtr model1, if ((item2 = virCPUx86DataGet(&model2->data, item1))) { if (x86cpuidMatch(&item1->cpuid, &item2->cpuid)) continue; - else if (!x86cpuidMatchMasked(&item1->cpuid, &item2->cpuid)) + else if (!virCPUx86DataItemMatchMasked(item1, item2)) match = SUBSET; } @@ -1174,7 +1174,7 @@ x86ModelCompare(virCPUx86ModelPtr model1, if ((item1 = virCPUx86DataGet(&model1->data, item2))) { if (x86cpuidMatch(&item2->cpuid, &item1->cpuid)) continue; - else if (!x86cpuidMatchMasked(&item2->cpuid, &item1->cpuid)) + else if (!virCPUx86DataItemMatchMasked(item2, item1)) match = SUPERSET; }