提交 3b474c1f 编写于 作者: J Jiri Denemark

cpu_x86: Introduce virCPUx86SignatureFromCPUID

It can be used for separating family, model, and stepping numbers from a
single 32b integer as reported by CPUID.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 372b2cf1
......@@ -717,6 +717,18 @@ x86MakeSignature(unsigned int family,
}
static void
virCPUx86SignatureFromCPUID(uint32_t sig,
unsigned int *family,
unsigned int *model,
unsigned int *stepping)
{
*family = ((sig >> 20) & 0xff) + ((sig >> 8) & 0xf);
*model = ((sig >> 12) & 0xf0) + ((sig >> 4) & 0xf);
*stepping = sig & 0xf;
}
static void
x86DataToSignatureFull(const virCPUx86Data *data,
unsigned int *family,
......@@ -725,17 +737,14 @@ x86DataToSignatureFull(const virCPUx86Data *data,
{
virCPUx86DataItem leaf1 = CPUID(.eax_in = 0x1);
virCPUx86DataItemPtr item;
virCPUx86CPUIDPtr cpuid;
*family = *model = *stepping = 0;
if (!(item = virCPUx86DataGet(data, &leaf1)))
return;
cpuid = &item->data.cpuid;
*family = ((cpuid->eax >> 20) & 0xff) + ((cpuid->eax >> 8) & 0xf);
*model = ((cpuid->eax >> 12) & 0xf0) + ((cpuid->eax >> 4) & 0xf);
*stepping = cpuid->eax & 0xf;
virCPUx86SignatureFromCPUID(item->data.cpuid.eax,
family, model, stepping);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册