mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
target: Use generic cpu_model_from_type()
Use generic cpu_model_from_type() when the CPU model name needs to be extracted from the CPU type name. Signed-off-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20231114235628.534334-23-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
f08f4c8ea4
commit
4b26aa9f3a
8 changed files with 8 additions and 16 deletions
|
@ -237,8 +237,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
|
||||||
|
|
||||||
typename = object_class_get_name(oc);
|
typename = object_class_get_name(oc);
|
||||||
info = g_malloc0(sizeof(*info));
|
info = g_malloc0(sizeof(*info));
|
||||||
info->name = g_strndup(typename,
|
info->name = cpu_model_from_type(typename);
|
||||||
strlen(typename) - strlen("-" TYPE_ARM_CPU));
|
|
||||||
info->q_typename = g_strdup(typename);
|
info->q_typename = g_strdup(typename);
|
||||||
|
|
||||||
QAPI_LIST_PREPEND(*cpu_list, info);
|
QAPI_LIST_PREPEND(*cpu_list, info);
|
||||||
|
|
|
@ -1744,8 +1744,7 @@ static char *x86_cpu_class_get_model_name(X86CPUClass *cc)
|
||||||
{
|
{
|
||||||
const char *class_name = object_class_get_name(OBJECT_CLASS(cc));
|
const char *class_name = object_class_get_name(OBJECT_CLASS(cc));
|
||||||
assert(g_str_has_suffix(class_name, X86_CPU_TYPE_SUFFIX));
|
assert(g_str_has_suffix(class_name, X86_CPU_TYPE_SUFFIX));
|
||||||
return g_strndup(class_name,
|
return cpu_model_from_type(class_name);
|
||||||
strlen(class_name) - strlen(X86_CPU_TYPE_SUFFIX));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct X86CPUVersionDefinition {
|
typedef struct X86CPUVersionDefinition {
|
||||||
|
|
|
@ -22,8 +22,7 @@ static void loongarch_cpu_add_definition(gpointer data, gpointer user_data)
|
||||||
CpuDefinitionInfo *info = g_new0(CpuDefinitionInfo, 1);
|
CpuDefinitionInfo *info = g_new0(CpuDefinitionInfo, 1);
|
||||||
const char *typename = object_class_get_name(oc);
|
const char *typename = object_class_get_name(oc);
|
||||||
|
|
||||||
info->name = g_strndup(typename,
|
info->name = cpu_model_from_type(typename);
|
||||||
strlen(typename) - strlen("-" TYPE_LOONGARCH_CPU));
|
|
||||||
info->q_typename = g_strdup(typename);
|
info->q_typename = g_strdup(typename);
|
||||||
|
|
||||||
QAPI_LIST_PREPEND(*cpu_list, info);
|
QAPI_LIST_PREPEND(*cpu_list, info);
|
||||||
|
|
|
@ -19,8 +19,7 @@ static void mips_cpu_add_definition(gpointer data, gpointer user_data)
|
||||||
|
|
||||||
typename = object_class_get_name(oc);
|
typename = object_class_get_name(oc);
|
||||||
info = g_malloc0(sizeof(*info));
|
info = g_malloc0(sizeof(*info));
|
||||||
info->name = g_strndup(typename,
|
info->name = cpu_model_from_type(typename);
|
||||||
strlen(typename) - strlen("-" TYPE_MIPS_CPU));
|
|
||||||
info->q_typename = g_strdup(typename);
|
info->q_typename = g_strdup(typename);
|
||||||
|
|
||||||
QAPI_LIST_PREPEND(*cpu_list, info);
|
QAPI_LIST_PREPEND(*cpu_list, info);
|
||||||
|
|
|
@ -7036,8 +7036,7 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = g_strndup(typename,
|
name = cpu_model_from_type(typename);
|
||||||
strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
|
|
||||||
qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr);
|
qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr);
|
||||||
for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
|
for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
|
||||||
PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
|
PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
|
||||||
|
|
|
@ -181,8 +181,7 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
|
||||||
|
|
||||||
typename = object_class_get_name(oc);
|
typename = object_class_get_name(oc);
|
||||||
info = g_malloc0(sizeof(*info));
|
info = g_malloc0(sizeof(*info));
|
||||||
info->name = g_strndup(typename,
|
info->name = cpu_model_from_type(typename);
|
||||||
strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
|
|
||||||
|
|
||||||
QAPI_LIST_PREPEND(*first, info);
|
QAPI_LIST_PREPEND(*first, info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -657,8 +657,7 @@ char *riscv_cpu_get_name(RISCVCPU *cpu)
|
||||||
|
|
||||||
g_assert(g_str_has_suffix(typename, RISCV_CPU_TYPE_SUFFIX));
|
g_assert(g_str_has_suffix(typename, RISCV_CPU_TYPE_SUFFIX));
|
||||||
|
|
||||||
return g_strndup(typename,
|
return cpu_model_from_type(typename);
|
||||||
strlen(typename) - strlen(RISCV_CPU_TYPE_SUFFIX));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||||
|
|
|
@ -44,8 +44,7 @@ static void riscv_cpu_add_definition(gpointer data, gpointer user_data)
|
||||||
const char *typename = object_class_get_name(oc);
|
const char *typename = object_class_get_name(oc);
|
||||||
ObjectClass *dyn_class;
|
ObjectClass *dyn_class;
|
||||||
|
|
||||||
info->name = g_strndup(typename,
|
info->name = cpu_model_from_type(typename);
|
||||||
strlen(typename) - strlen("-" TYPE_RISCV_CPU));
|
|
||||||
info->q_typename = g_strdup(typename);
|
info->q_typename = g_strdup(typename);
|
||||||
|
|
||||||
dyn_class = object_class_dynamic_cast(oc, TYPE_RISCV_DYNAMIC_CPU);
|
dyn_class = object_class_dynamic_cast(oc, TYPE_RISCV_DYNAMIC_CPU);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue