[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 19/88] target/hppa: Introduce TYPE_HPPA64_CPU
|
From: |
Richard Henderson |
|
Subject: |
[PATCH v3 19/88] target/hppa: Introduce TYPE_HPPA64_CPU |
|
Date: |
Wed, 1 Nov 2023 18:29:07 -0700 |
Prepare for the qemu binary supporting both pa10 and pa20
at the same time.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/hppa/cpu-qom.h | 1 +
target/hppa/cpu.h | 5 +++++
target/hppa/cpu.c | 33 ++++++++++++++++++---------------
target/hppa/translate.c | 2 ++
4 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/target/hppa/cpu-qom.h b/target/hppa/cpu-qom.h
index b96e0318c7..4a85ebf5e0 100644
--- a/target/hppa/cpu-qom.h
+++ b/target/hppa/cpu-qom.h
@@ -24,6 +24,7 @@
#include "qom/object.h"
#define TYPE_HPPA_CPU "hppa-cpu"
+#define TYPE_HPPA64_CPU "hppa64-cpu"
OBJECT_DECLARE_CPU_TYPE(HPPACPU, HPPACPUClass, HPPA_CPU)
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index 08de894393..0ac307e0e9 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -272,6 +272,11 @@ struct ArchCPU {
#include "exec/cpu-all.h"
+static inline bool hppa_is_pa20(CPUHPPAState *env)
+{
+ return object_dynamic_cast(OBJECT(env_cpu(env)), TYPE_HPPA64_CPU) != NULL;
+}
+
static inline int cpu_mmu_index(CPUHPPAState *env, bool ifetch)
{
#ifdef CONFIG_USER_ONLY
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 5e1240c631..07fae42bb8 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -209,20 +209,23 @@ static void hppa_cpu_class_init(ObjectClass *oc, void
*data)
cc->tcg_ops = &hppa_tcg_ops;
}
-static const TypeInfo hppa_cpu_type_info = {
- .name = TYPE_HPPA_CPU,
- .parent = TYPE_CPU,
- .instance_size = sizeof(HPPACPU),
- .instance_align = __alignof(HPPACPU),
- .instance_init = hppa_cpu_initfn,
- .abstract = false,
- .class_size = sizeof(HPPACPUClass),
- .class_init = hppa_cpu_class_init,
+static const TypeInfo hppa_cpu_type_infos[] = {
+ {
+ .name = TYPE_HPPA_CPU,
+ .parent = TYPE_CPU,
+ .instance_size = sizeof(HPPACPU),
+ .instance_align = __alignof(HPPACPU),
+ .instance_init = hppa_cpu_initfn,
+ .abstract = false,
+ .class_size = sizeof(HPPACPUClass),
+ .class_init = hppa_cpu_class_init,
+ },
+#ifdef TARGET_HPPA64
+ {
+ .name = TYPE_HPPA64_CPU,
+ .parent = TYPE_HPPA_CPU,
+ },
+#endif
};
-static void hppa_cpu_register_types(void)
-{
- type_register_static(&hppa_cpu_type_info);
-}
-
-type_init(hppa_cpu_register_types)
+DEFINE_TYPES(hppa_cpu_type_infos)
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index ed88f724ce..44c9911720 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -262,6 +262,7 @@ typedef struct DisasContext {
int mmu_idx;
int privilege;
bool psw_n_nonzero;
+ bool is_pa20;
#ifdef CONFIG_USER_ONLY
MemOp unalign;
@@ -4091,6 +4092,7 @@ static void hppa_tr_init_disas_context(DisasContextBase
*dcbase, CPUState *cs)
ctx->cs = cs;
ctx->tb_flags = ctx->base.tb->flags;
+ ctx->is_pa20 = hppa_is_pa20(cpu_env(cs));
#ifdef CONFIG_USER_ONLY
ctx->privilege = MMU_IDX_TO_PRIV(MMU_USER_IDX);
--
2.34.1
- [PATCH v3 01/88] target/hppa: Include PSW_P in tb flags and mmu index, (continued)
- [PATCH v3 01/88] target/hppa: Include PSW_P in tb flags and mmu index, Richard Henderson, 2023/11/01
- [PATCH v3 02/88] target/hppa: Rename hppa_tlb_entry to HPPATLBEntry, Richard Henderson, 2023/11/01
- [PATCH v3 14/88] target/hppa: Truncate rotate count in trans_shrpw_sar, Richard Henderson, 2023/11/01
- [PATCH v3 09/88] target/hppa: Remove get_temp, Richard Henderson, 2023/11/01
- [PATCH v3 04/88] target/hppa: Always report one page to tlb_set_page, Richard Henderson, 2023/11/01
- [PATCH v3 18/88] target/hppa: Fix extrw and depw with sar for hppa64, Richard Henderson, 2023/11/01
- [PATCH v3 15/88] target/hppa: Fix trans_ds for hppa64, Richard Henderson, 2023/11/01
- [PATCH v3 17/88] target/hppa: Fix bb_sar for hppa64, Richard Henderson, 2023/11/01
- [PATCH v3 06/88] target/hppa: Populate an interval tree with valid tlb entries, Richard Henderson, 2023/11/01
- [PATCH v3 12/88] target/hppa: Fix hppa64 case in machine.c, Richard Henderson, 2023/11/01
- [PATCH v3 19/88] target/hppa: Introduce TYPE_HPPA64_CPU,
Richard Henderson <=
- [PATCH v3 16/88] target/hppa: Fix do_add, do_sub for hppa64, Richard Henderson, 2023/11/01
- [PATCH v3 23/88] target/hppa: Update cpu_hppa_get/put_psw for hppa64, Richard Henderson, 2023/11/01
- [PATCH v3 13/88] target/hppa: Fix load in do_load_32, Richard Henderson, 2023/11/01
- [PATCH v3 11/88] target/hppa: Remove load_const, Richard Henderson, 2023/11/01
- [PATCH v3 22/88] target/hppa: Implement hppa_cpu_class_by_name, Richard Henderson, 2023/11/01
- [PATCH v3 25/88] target/hppa: Adjust hppa_cpu_dump_state for hppa64, Richard Henderson, 2023/11/01
- [PATCH v3 24/88] target/hppa: Handle absolute addresses for pa2.0, Richard Henderson, 2023/11/01
- [PATCH v3 21/88] target/hppa: Implement cpu_list, Richard Henderson, 2023/11/01
- [PATCH v3 26/88] target/hppa: Fix hppa64 addressing, Richard Henderson, 2023/11/01
- [PATCH v3 31/88] target/hppa: sar register allows only 5 bits on 32-bit CPU, Richard Henderson, 2023/11/01