target/mips: Move mips_cpu_add_definition() from helper.c to cpu.c
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20201206233949.3783184-10-f4bug@amsat.org>
This commit is contained in:
parent
ffa657ee70
commit
a10b453a52
@ -30,6 +30,7 @@
|
|||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
#include "hw/qdev-clock.h"
|
#include "hw/qdev-clock.h"
|
||||||
|
#include "qapi/qapi-commands-machine-target.h"
|
||||||
|
|
||||||
static void mips_cpu_set_pc(CPUState *cs, vaddr value)
|
static void mips_cpu_set_pc(CPUState *cs, vaddr value)
|
||||||
{
|
{
|
||||||
@ -299,6 +300,38 @@ static void mips_cpu_register_types(void)
|
|||||||
|
|
||||||
type_init(mips_cpu_register_types)
|
type_init(mips_cpu_register_types)
|
||||||
|
|
||||||
|
static void mips_cpu_add_definition(gpointer data, gpointer user_data)
|
||||||
|
{
|
||||||
|
ObjectClass *oc = data;
|
||||||
|
CpuDefinitionInfoList **cpu_list = user_data;
|
||||||
|
CpuDefinitionInfoList *entry;
|
||||||
|
CpuDefinitionInfo *info;
|
||||||
|
const char *typename;
|
||||||
|
|
||||||
|
typename = object_class_get_name(oc);
|
||||||
|
info = g_malloc0(sizeof(*info));
|
||||||
|
info->name = g_strndup(typename,
|
||||||
|
strlen(typename) - strlen("-" TYPE_MIPS_CPU));
|
||||||
|
info->q_typename = g_strdup(typename);
|
||||||
|
|
||||||
|
entry = g_malloc0(sizeof(*entry));
|
||||||
|
entry->value = info;
|
||||||
|
entry->next = *cpu_list;
|
||||||
|
*cpu_list = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||||
|
{
|
||||||
|
CpuDefinitionInfoList *cpu_list = NULL;
|
||||||
|
GSList *list;
|
||||||
|
|
||||||
|
list = object_class_get_list(TYPE_MIPS_CPU, false);
|
||||||
|
g_slist_foreach(list, mips_cpu_add_definition, &cpu_list);
|
||||||
|
g_slist_free(list);
|
||||||
|
|
||||||
|
return cpu_list;
|
||||||
|
}
|
||||||
|
|
||||||
/* Could be used by generic CPU object */
|
/* Could be used by generic CPU object */
|
||||||
MIPSCPU *mips_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
|
MIPSCPU *mips_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "exec/cpu_ldst.h"
|
#include "exec/cpu_ldst.h"
|
||||||
#include "exec/log.h"
|
#include "exec/log.h"
|
||||||
#include "hw/mips/cpudevs.h"
|
#include "hw/mips/cpudevs.h"
|
||||||
#include "qapi/qapi-commands-machine-target.h"
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TLBRET_XI = -6,
|
TLBRET_XI = -6,
|
||||||
@ -1500,35 +1499,3 @@ void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,
|
|||||||
|
|
||||||
cpu_loop_exit_restore(cs, pc);
|
cpu_loop_exit_restore(cs, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mips_cpu_add_definition(gpointer data, gpointer user_data)
|
|
||||||
{
|
|
||||||
ObjectClass *oc = data;
|
|
||||||
CpuDefinitionInfoList **cpu_list = user_data;
|
|
||||||
CpuDefinitionInfoList *entry;
|
|
||||||
CpuDefinitionInfo *info;
|
|
||||||
const char *typename;
|
|
||||||
|
|
||||||
typename = object_class_get_name(oc);
|
|
||||||
info = g_malloc0(sizeof(*info));
|
|
||||||
info->name = g_strndup(typename,
|
|
||||||
strlen(typename) - strlen("-" TYPE_MIPS_CPU));
|
|
||||||
info->q_typename = g_strdup(typename);
|
|
||||||
|
|
||||||
entry = g_malloc0(sizeof(*entry));
|
|
||||||
entry->value = info;
|
|
||||||
entry->next = *cpu_list;
|
|
||||||
*cpu_list = entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
|
||||||
{
|
|
||||||
CpuDefinitionInfoList *cpu_list = NULL;
|
|
||||||
GSList *list;
|
|
||||||
|
|
||||||
list = object_class_get_list(TYPE_MIPS_CPU, false);
|
|
||||||
g_slist_foreach(list, mips_cpu_add_definition, &cpu_list);
|
|
||||||
g_slist_free(list);
|
|
||||||
|
|
||||||
return cpu_list;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user