@@ -732,12 +732,22 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data)
#endif
}
+static void loongarch32_cpu_class_init(ObjectClass *c, void *data)
+{
+}
+
#define DEFINE_LOONGARCH_CPU_TYPE(model, initfn) \
{ \
.parent = TYPE_LOONGARCH_CPU, \
.instance_init = initfn, \
.name = LOONGARCH_CPU_TYPE_NAME(model), \
}
+#define DEFINE_LOONGARCH32_CPU_TYPE(model, initfn) \
+ { \
+ .parent = TYPE_LOONGARCH32_CPU, \
+ .instance_init = initfn, \
+ .name = LOONGARCH_CPU_TYPE_NAME(model), \
+ }
static const TypeInfo loongarch_cpu_type_infos[] = {
{
@@ -750,6 +760,15 @@ static const TypeInfo loongarch_cpu_type_infos[] = {
.class_size = sizeof(LoongArchCPUClass),
.class_init = loongarch_cpu_class_init,
},
+ {
+ .name = TYPE_LOONGARCH32_CPU,
+ .parent = TYPE_LOONGARCH_CPU,
+ .instance_size = sizeof(LoongArchCPU),
+
+ .abstract = true,
+ .class_size = sizeof(LoongArchCPUClass),
+ .class_init = loongarch32_cpu_class_init,
+ },
DEFINE_LOONGARCH_CPU_TYPE("la464", loongarch_la464_initfn),
};
@@ -382,6 +382,7 @@ struct ArchCPU {
};
#define TYPE_LOONGARCH_CPU "loongarch-cpu"
+#define TYPE_LOONGARCH32_CPU "loongarch32-cpu"
OBJECT_DECLARE_CPU_TYPE(LoongArchCPU, LoongArchCPUClass,
LOONGARCH_CPU)
Add object class for future loongarch32 cpus. It is derived from the loongarch64 object class. Signed-off-by: Jiajie Chen <c@jia.je> --- target/loongarch/cpu.c | 19 +++++++++++++++++++ target/loongarch/cpu.h | 1 + 2 files changed, 20 insertions(+)