aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-09-17 18:42:27 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-11-06 18:49:33 -0800
commitca4c2008f53cd08dd82789384aeba87754d15152 (patch)
tree407cf0512cbdf4272ae49a48a567e7e98beff02c
parentd3ae32d4d208bd73c8e1bc81d76017268e2455fc (diff)
downloadqemu-ca4c2008f53cd08dd82789384aeba87754d15152.zip
qemu-ca4c2008f53cd08dd82789384aeba87754d15152.tar.gz
qemu-ca4c2008f53cd08dd82789384aeba87754d15152.tar.bz2
target/hppa: Implement hppa_cpu_class_by_name
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--linux-user/hppa/target_elf.h2
-rw-r--r--target/hppa/cpu.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/linux-user/hppa/target_elf.h b/linux-user/hppa/target_elf.h
index 82b4e95..19cae8b 100644
--- a/linux-user/hppa/target_elf.h
+++ b/linux-user/hppa/target_elf.h
@@ -9,6 +9,6 @@
#define HPPA_TARGET_ELF_H
static inline const char *cpu_get_model(uint32_t eflags)
{
- return "any";
+ return "hppa";
}
#endif
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 27c74f0..70ce0c3 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -158,7 +158,15 @@ static void hppa_cpu_initfn(Object *obj)
static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
{
- return object_class_by_name(TYPE_HPPA_CPU);
+ g_autofree char *typename = g_strconcat(cpu_model, "-cpu", NULL);
+ ObjectClass *oc = object_class_by_name(typename);
+
+ if (oc &&
+ !object_class_is_abstract(oc) &&
+ object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) {
+ return oc;
+ }
+ return NULL;
}
static void hppa_cpu_list_entry(gpointer data, gpointer user_data)