Skip to content

Commit

Permalink
target/loongarch: Extract 64-bit specifics to loongarch64_cpu_class_init
Browse files Browse the repository at this point in the history
Extract loongarch64 specific code from loongarch_cpu_class_init()
to a new loongarch64_cpu_class_init().

In preparation of supporting loongarch32 cores, rename these
functions using the '64' suffix.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230821125959.28666-6-philmd@linaro.org>
Signed-off-by: Song Gao <gaosong@loongson.cn>
  • Loading branch information
philmd authored and gaosong-loongson committed Aug 24, 2023
1 parent 146f235 commit e389358
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions target/loongarch/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,6 @@ static const struct SysemuCPUOps loongarch_sysemu_ops = {
};
#endif

static gchar *loongarch_gdb_arch_name(CPUState *cs)
{
return g_strdup("loongarch64");
}

static void loongarch_cpu_class_init(ObjectClass *c, void *data)
{
LoongArchCPUClass *lacc = LOONGARCH_CPU_CLASS(c);
Expand All @@ -724,16 +719,27 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data)
cc->disas_set_info = loongarch_cpu_disas_set_info;
cc->gdb_read_register = loongarch_cpu_gdb_read_register;
cc->gdb_write_register = loongarch_cpu_gdb_write_register;
cc->gdb_num_core_regs = 35;
cc->gdb_core_xml_file = "loongarch-base64.xml";
cc->gdb_stop_before_watchpoint = true;
cc->gdb_arch_name = loongarch_gdb_arch_name;

#ifdef CONFIG_TCG
cc->tcg_ops = &loongarch_tcg_ops;
#endif
}

static gchar *loongarch64_gdb_arch_name(CPUState *cs)
{
return g_strdup("loongarch64");
}

static void loongarch64_cpu_class_init(ObjectClass *c, void *data)
{
CPUClass *cc = CPU_CLASS(c);

cc->gdb_num_core_regs = 35;
cc->gdb_core_xml_file = "loongarch-base64.xml";
cc->gdb_arch_name = loongarch64_gdb_arch_name;
}

#define DEFINE_LOONGARCH_CPU_TYPE(size, model, initfn) \
{ \
.parent = TYPE_LOONGARCH##size##_CPU, \
Expand All @@ -757,6 +763,7 @@ static const TypeInfo loongarch_cpu_type_infos[] = {
.parent = TYPE_LOONGARCH_CPU,

.abstract = true,
.class_init = loongarch64_cpu_class_init,
},
DEFINE_LOONGARCH_CPU_TYPE(64, "la464", loongarch_la464_initfn),
};
Expand Down

0 comments on commit e389358

Please sign in to comment.