[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 07/32] target/i386: Use generic helper to show CPU model names
From: |
Gavin Shan |
Subject: |
[PATCH v3 07/32] target/i386: Use generic helper to show CPU model names |
Date: |
Thu, 7 Sep 2023 10:35:28 +1000 |
For target/i386, the CPU type name is always the combination of the
CPU model name and suffix. The CPU model names have been shown
correctly in x86_cpu_list_entry().
Use generic helper cpu_model_from_type() to get the CPU model name
from the CPU type name in x86_cpu_class_get_model_name(), and rename
@name to @model in x86_cpu_list_entry() since it points to the CPU
model name instead of the CPU type name.
Signed-off-by: Gavin Shan <gshan@redhat.com>
---
target/i386/cpu.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 00f913b638..31f1d0379e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1741,8 +1741,7 @@ static char *x86_cpu_class_get_model_name(X86CPUClass *cc)
{
const char *class_name = object_class_get_name(OBJECT_CLASS(cc));
assert(g_str_has_suffix(class_name, X86_CPU_TYPE_SUFFIX));
- return g_strndup(class_name,
- strlen(class_name) - strlen(X86_CPU_TYPE_SUFFIX));
+ return cpu_model_from_type(class_name);
}
typedef struct X86CPUVersionDefinition {
@@ -5544,7 +5543,7 @@ static void x86_cpu_list_entry(gpointer data, gpointer
user_data)
{
ObjectClass *oc = data;
X86CPUClass *cc = X86_CPU_CLASS(oc);
- g_autofree char *name = x86_cpu_class_get_model_name(cc);
+ g_autofree char *model = x86_cpu_class_get_model_name(cc);
g_autofree char *desc = g_strdup(cc->model_description);
g_autofree char *alias_of = x86_cpu_class_get_alias_of(cc);
g_autofree char *model_id = x86_cpu_class_get_model_id(cc);
@@ -5568,7 +5567,7 @@ static void x86_cpu_list_entry(gpointer data, gpointer
user_data)
desc = g_strdup_printf("%s (deprecated)", olddesc);
}
- qemu_printf("x86 %-20s %s\n", name, desc);
+ qemu_printf("x86 %-20s %s\n", model, desc);
}
/* list available CPU models and flags */
--
2.41.0
- [PATCH v3 00/32] Unified CPU type check, Gavin Shan, 2023/09/06
- [PATCH v3 01/32] cpu: Add helper cpu_model_from_type(), Gavin Shan, 2023/09/06
- [PATCH v3 02/32] target/alpha: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 03/32] target/arm: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 04/32] target/avr: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 05/32] target/cris: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 06/32] target/hexagon: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 07/32] target/i386: Use generic helper to show CPU model names,
Gavin Shan <=
- [PATCH v3 08/32] target/loongarch: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 09/32] target/m68k: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 10/32] target/mips: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 11/32] target/openrisc: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 12/32] target/ppc: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 13/32] target/riscv: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 14/32] target/rx: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
- [PATCH v3 15/32] target/s390x: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06