aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2017-07-12 13:20:57 -0300
committerEduardo Habkost <ehabkost@redhat.com>2017-07-26 14:55:12 -0300
commit7d8050b5142c5b9132be25835a3d7f261f1411a6 (patch)
tree875b4654c1811fa3d9536c8ec7243f037f37e0dc /target
parentbfef624895673866b4beb1757725a565c7048c1f (diff)
target/i386: Define CPUID_MODEL_ID_SZ macro
Document cpu_x86_fill_model_id() and define CPUID_MODEL_ID_SZ to help callers use the right buffer size. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20170712162058.10538-4-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target')
-rw-r--r--target/i386/cpu.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 156dc955d2..8558c600bf 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1585,6 +1585,17 @@ static bool lmce_supported(void)
return !!(mce_cap & MCG_LMCE_P);
}
+#define CPUID_MODEL_ID_SZ 48
+
+/**
+ * cpu_x86_fill_model_id:
+ * Get CPUID model ID string from host CPU.
+ *
+ * @str should have at least CPUID_MODEL_ID_SZ bytes
+ *
+ * The function does NOT add a null terminator to the string
+ * automatically.
+ */
static int cpu_x86_fill_model_id(char *str)
{
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;